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 58810cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
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 return false', () => {
expect(ssgulnur('Bad value')).toBeFalsy();
});
});

0 comments on commit 58810cc

Please sign in to comment.