diff --git a/tests/with-injection/create/with-bogus/lib-bogus-empty-object.test.js b/tests/with-injection/create/with-bogus/lib-bogus-empty-object.test.js new file mode 100644 index 00000000..48e846ab --- /dev/null +++ b/tests/with-injection/create/with-bogus/lib-bogus-empty-object.test.js @@ -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`); +}); diff --git a/tests/with-injection/create/with-bogus/lib-bogus-null-object.test.js b/tests/with-injection/create/with-bogus/lib-bogus-null-object.test.js new file mode 100644 index 00000000..5227c30c --- /dev/null +++ b/tests/with-injection/create/with-bogus/lib-bogus-null-object.test.js @@ -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`); +});