Skip to content

Commit

Permalink
tests(index): use os platform when testing constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Frazer Smith committed Jul 16, 2020
1 parent ba5d231 commit bb1112b
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const glob = require('glob');
const os = require('os');
const path = require('path');
const { Poppler } = require('./index');

Expand Down Expand Up @@ -28,13 +29,34 @@ describe('Constructor', () => {
});

test('Should convert PDF file to SVG file with binary path set', async () => {
const testPath = path.join(
__dirname,
'lib',
'win32',
'poppler-0.89.0',
'bin'
);
const platform = os.platform();
let testPath;

switch (platform) {
// Windows OS
case 'win32':
default:
testPath = path.join(
__dirname,
'lib',
'win32',
'poppler-0.89.0',
'bin'
);
break;

// macOS
case 'darwin':
testPath = path.join(
__dirname,
'lib',
'darwin',
'poppler-0.89.0',
'bin'
);
break;
}

const poppler = new Poppler(testPath);
const options = {
svgFile: true
Expand Down

0 comments on commit bb1112b

Please sign in to comment.