Created
May 29, 2019 09:38
-
-
Save Oliver-ke/8b71f38f183d79649c90b884a5dec880 to your computer and use it in GitHub Desktop.
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
const { assert } = require('chai'); | |
const computeResult = require('../challange/computeResult'); | |
describe('return sum', () => { | |
it('Must be a function', () => { | |
assert.isFunction(computeResult, 'must be a function'); | |
}); | |
it('Return the result', () => { | |
const answers = [ 'a', 'b', 'a', 'c' ]; | |
const studentAns = [ 'a', 'c', 'd', 'c' ]; | |
const sum = computeResult(answers, studentAns); | |
assert.equal(sum, 6); | |
}); | |
it('Account for empty answers', () => { | |
const answers = [ 'a', 'b', 'a', 'c' ]; | |
const studentAns = [ 'a', 'c', 'd', ' ' ]; | |
const sum = computeResult(answers, studentAns); | |
assert.equal(sum, 2); | |
}); | |
it('Return 0 if result is less than zero', () => { | |
const answers = [ 'a', 'b', 'a', 'c' ]; | |
const studentAns = [ 'c', 'c', 'd', 'm' ]; | |
const sum = computeResult(answers, studentAns); | |
assert.equal(sum, 0); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test for computing result function