Skip to content

Commit 3440ded

Browse files
author
Christopher J. Brody
committed
test lib with bogus name: null option
(expected to throw an error) covers the following code in `lib/normalized-options.js`: if (typeof name !== 'string') { throw new TypeError("Please write your library's name"); }
1 parent 2d29dba commit 3440ded

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const lib = require('../../../../lib/lib.js');
2+
3+
const ioInject = require('../../helpers/io-inject.js');
4+
5+
test('create module with bogus null name', async () => {
6+
// with snapshot info ignored in this test
7+
const inject = ioInject([]);
8+
9+
const options = {
10+
name: null
11+
};
12+
13+
let error;
14+
try {
15+
// expected to throw:
16+
await lib(options, inject);
17+
} catch (e) {
18+
error = e;
19+
}
20+
expect(error).toBeDefined();
21+
expect(error.message).toMatch(`Please write your library's name`);
22+
});

0 commit comments

Comments
 (0)