Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const lib = require('../../../../lib/lib.js');

const ioInject = require('../../helpers/io-inject.js');

test('create module with bogus empty object', async () => {
// with snapshot info ignored in this test
const inject = ioInject([]);

const options = {};

let error;
try {
// expected to throw:
await lib(options, inject);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toMatch(`Please write your library's name`);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const lib = require('../../../../lib/lib.js');

const ioInject = require('../../helpers/io-inject.js');

test('create module with bogus null object', async () => {
// with snapshot info ignored in this test
const inject = ioInject([]);

const options = null;

let error;
try {
// expected to throw:
await lib(options, inject);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toMatch(`Cannot read property 'name' of null`);
});