Skip to content

Commit

Permalink
added tests for ssgulnur, createFolder and parseJSON functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mnosov622 committed Nov 14, 2022
1 parent 9980709 commit 9630a19
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/unit/__snapshots__/options.test.js.snap
Original file line number Diff line number Diff line change
@@ -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`;
12 changes: 11 additions & 1 deletion test/unit/helper.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { checkSource } = require('../../src/helper');
const { checkSource, createFolder, parseJSON } = require('../../src/helper');

describe('checkSource', () => {
test('invalid path should return "none"', () => {
Expand All @@ -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);
});
});
11 changes: 11 additions & 0 deletions test/unit/options.test.js
Original file line number Diff line number Diff line change
@@ -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();
});
});

0 comments on commit 9630a19

Please sign in to comment.