diff --git a/test/unit/__snapshots__/options.test.js.snap b/test/unit/__snapshots__/options.test.js.snap new file mode 100644 index 0000000..7b97a80 --- /dev/null +++ b/test/unit/__snapshots__/options.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test the main function with bad values check if calling a function with bad value will match snapshot 1`] = `undefined`; diff --git a/test/unit/helper.test.js b/test/unit/helper.test.js index ccac4af..3b3db7b 100644 --- a/test/unit/helper.test.js +++ b/test/unit/helper.test.js @@ -1,4 +1,4 @@ -const { checkSource } = require('../../src/helper'); +const { checkSource, createFolder, parseJSON } = require('../../src/helper'); describe('checkSource', () => { test('invalid path should return "none"', () => { @@ -13,3 +13,13 @@ describe('checkSource', () => { expect(checkSource('test/unit/helper.test.js')).toBe('file'); }); }); + +describe('testing functions for output', () => { + test('nothing passed to function should return false', () => { + expect(createFolder()).toBeFalsy(); + }); + + test('wrong path passed to function should return null', () => { + expect(parseJSON('wrong path')).toBe(null); + }); +}); diff --git a/test/unit/options.test.js b/test/unit/options.test.js new file mode 100644 index 0000000..57467aa --- /dev/null +++ b/test/unit/options.test.js @@ -0,0 +1,11 @@ +const ssgulnur = require('../../src/options'); + +describe('test the main function with bad values', () => { + test('return false if bad argument is passed to a function', () => { + expect(ssgulnur('')).toBeFalsy(); + }); + + test('check if calling a function with bad value will match snapshot', () => { + expect(ssgulnur('Bad value')).toMatchSnapshot(); + }); +});