Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added tests for ssgulnur, createFolder and parseJSON functions #18

Merged
merged 1 commit into from
Nov 14, 2022
Merged
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
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();
});
});