Skip to content

Commit 588ee30

Browse files
committed
test: update to Promise
1 parent c7e446b commit 588ee30

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

test/test-out-resolve.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
import test from 'ava';
2+
import isPromise from 'is-promise';
23
import outResolve from '../src/out-resolve';
34

45
test('should return function', t => {
56
t.true(typeof outResolve === 'function');
67
});
78

8-
test('only input should return file.ext', t => {
9-
t.is(outResolve('file.ext'), 'file.ext');
9+
test('should return Promise', t => {
10+
t.true(isPromise(outResolve()));
1011
});
1112

12-
test('only input should return tmp/file.ext', t => {
13-
t.is(outResolve('tmp/file.ext'), 'tmp/file.ext');
13+
test('only input should return file.ext', async t => {
14+
t.is(await outResolve('file.ext'), 'file.ext');
1415
});
1516

16-
test('input file and output file should return output.ext', t => {
17-
t.is(outResolve('file.ext', 'output.ext'), 'output.ext');
17+
test('only input should return tmp/file.ext', async t => {
18+
t.is(await outResolve('tmp/file.ext'), 'tmp/file.ext');
1819
});
1920

20-
test('input file and output folder should return tmp/file.ext', t => {
21-
t.is(outResolve('file.ext', 'tmp'), 'tmp/file.ext');
21+
test('input file and output file should return output.ext', async t => {
22+
t.is(await outResolve('file.ext', 'output.ext'), 'output.ext');
2223
});
2324

24-
test('input files and output folder should return tmp/test/*.ext', t => {
25-
t.is(outResolve('test/*.ext', 'tmp'), 'tmp/test/*.ext');
25+
test('input file and output folder should return tmp/file.ext', async t => {
26+
t.is(await outResolve('file.ext', 'tmp'), 'tmp/file.ext');
2627
});
2728

28-
test('input files and output file should return output.ext', t => {
29-
t.is(outResolve('test/*', 'output.ext'), 'output.ext');
29+
test('input files and output folder should return tmp/test/*.ext', async t => {
30+
t.is(await outResolve('test/*.ext', 'tmp'), 'tmp/test/*.ext');
3031
});
3132

32-
test('input files and output file should return tmp/output.ext', t => {
33-
t.is(outResolve('test/*', 'tmp/output.ext'), 'tmp/output.ext');
33+
test('input files and output file should return output.ext', async t => {
34+
t.is(await outResolve('test/*', 'output.ext'), 'output.ext');
35+
});
36+
37+
test('input files and output file should return tmp/output.ext', async t => {
38+
t.is(await outResolve('test/*', 'tmp/output.ext'), 'tmp/output.ext');
3439
});
3540

0 commit comments

Comments
 (0)