Skip to content

Commit 785d64c

Browse files
committed
test: test modified to argument changes
1 parent 59cdbf1 commit 785d64c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/out-resolve.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22

3-
export default (input, {output, root, allInOutput}) => new Promise(resolve => {
3+
export default (input, {output, root, allInOutput} = {}) => new Promise(resolve => {
44
if (output && path.extname(output)) {
55
return resolve(output);
66
}
@@ -11,8 +11,9 @@ export default (input, {output, root, allInOutput}) => new Promise(resolve => {
1111
if (allInOutput) {
1212
inputPath = path.relative(root, input);
1313
}
14+
1415
return resolve(path.join(output, inputPath));
1516
}
1617

17-
resolve(input);
18+
return resolve(input);
1819
});

test/test-out-resolve.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ test('only input should return tmp/file.ext', async t => {
2020
});
2121

2222
test('input file and output file should return output.ext', async t => {
23-
t.is(await outResolve('file.ext', 'output.ext'), 'output.ext');
23+
t.is(await outResolve('file.ext', {output: 'output.ext'}), 'output.ext');
2424
});
2525

2626
test('input file and output folder should return tmp/file.ext', async t => {
27-
t.is(await outResolve('file.ext', 'tmp'), path.normalize('tmp/file.ext'));
27+
t.is(await outResolve('file.ext', {output: 'tmp'}), path.normalize('tmp/file.ext'));
2828
});
2929

3030
test('input files and output folder should return tmp/test/*.ext', async t => {
3131
t.is(await outResolve(path.normalize('tmp/test/*.ext'), undefined), path.normalize('tmp/test/*.ext'));
3232
});
3333

3434
test('input files and output file should return output.ext', async t => {
35-
t.is(await outResolve('test/*', 'output.ext'), 'output.ext');
35+
t.is(await outResolve('test/*', {output: 'output.ext'}), 'output.ext');
3636
});
3737

3838
test('input files and output file should return tmp/output.ext', async t => {
39-
t.is(await outResolve('test/*', 'tmp/output.ext'), 'tmp/output.ext');
39+
t.is(await outResolve('test/*', {output: 'tmp/output.ext'}), 'tmp/output.ext');
4040
});
4141

0 commit comments

Comments
 (0)