Created
April 25, 2021 01:26
-
-
Save passandscore/58843750fe5fd0f8d145e08f155900bb to your computer and use it in GitHub Desktop.
Unit Testing Template (Mocha & Chai)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Unit testing template | |
//Language: JavaScript | |
//Packages: Mocha, Chai | |
//Javascript file | |
module.exports = subSum; | |
//JavaScript test file | |
const { expect, assert, should } = require('chai'); | |
const subSum = require('./subSum'); | |
should(); | |
describe('Test subSum Function', () => { | |
it('Should retuen NaN if the first element is not an array', () => { | |
assert.equal(isNaN(subSum([10, 20, 30, 40, 50], 3, 300)), isNaN(1)) | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment