Skip to content

Commit b007e24

Browse files
treshugartd4rkr00t
authored andcommitted
Add tests
Since there was no default, and now there is, I've updated the default testing method to use the default script name and added a test to test the custom script name explicitly.
1 parent 52384bf commit b007e24

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: test.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const child = require('child_process');
55
const path = require('path');
66
const bin = path.join(__dirname, 'bin.js');
77

8-
function exec(command) {
9-
return child.execSync(`${bin} ./fixture.js ${command}`, { stdio: 'pipe' }).toString();
8+
function exec(command, script = '') {
9+
return child.execSync(`${bin} ${script} ${command}`, { stdio: 'pipe' }).toString();
1010
}
1111

1212
test('success', () => {
@@ -20,3 +20,7 @@ test('failure', () => {
2020
test('unserializable', () => {
2121
expect(() => { exec('UNSERIALIZABLE'); }).toThrow('Converting circular structure to JSON');
2222
});
23+
24+
test('custom projector file', () => {
25+
expect(JSON.parse(exec('SUCCESS --foo 1', './projector-custom.js'))).toEqual({ opts: { foo: 1 } });
26+
});

0 commit comments

Comments
 (0)