Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit 3b77fe6

Browse files
committed
Simplify unit test
1 parent 3440049 commit 3b77fe6

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

platform/lib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function checkM3u(file, cwd) {
1010
}
1111
)
1212
.on('close', code =>
13-
code === 0 ? reject(code) : resolve(code)
13+
code === 0 ? reject('File looks like an M3U, bailing out') : resolve(code)
1414
)
1515
);
16-
}
16+
}

test/unit/lib.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,10 @@ import {checkM3u} from '../../platform/lib';
66
const cwd = path.resolve(__dirname, '../fixtures');
77

88
test('Check for m3u8 with valid m3u8 file', async t => {
9-
try {
10-
await checkM3u('bad.mp4', cwd);
11-
t.fail('Promise did not reject');
12-
} catch (err) {
13-
t.pass();
14-
}
9+
const error = await t.throws(checkM3u('bad.mp4', cwd));
10+
t.is(error, 'File looks like an M3U, bailing out');
1511
});
1612

1713
test('Check for m3u8 with valid mp4 file', async t => {
18-
try {
19-
await checkM3u('good.mp4', cwd);
20-
t.pass();
21-
} catch (err) {
22-
t.fail();
23-
}
24-
});
14+
await t.notThrows(checkM3u('good.mp4', cwd));
15+
});

0 commit comments

Comments
 (0)