Files
JavaScript/Project-Euler/test/Problem001.test.js
Omkarnath Parida 4df1e9e90e tests: Project Euler Problem 1 (#1161)
* 📦 NEW: Added solution for ProjectEuler-007

* 🐛 FIX: Spelling mistake fixes

* 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input

* 👌 IMPROVE: Modified the code

* 👌 IMPROVE: Added test case for ProjectEuler Problem001

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2022-10-15 14:58:06 +05:30

18 lines
657 B
JavaScript

import { multiplesThreeAndFive } from '../Problem001.js'
describe('Sum of multiples of 3 or 5', () => {
it('should throw error when number is negative number', () => {
expect(() => multiplesThreeAndFive(-24)).toThrowError('No natural numbers exist below 1')
})
it('should throw error when number is 0', () => {
expect(() => multiplesThreeAndFive(0)).toThrowError('No natural numbers exist below 1')
})
test('if the number is greater than 0', () => {
expect(multiplesThreeAndFive(10)).toBe(23)
})
// Project Euler Condition Check
test('if the number is 1000', () => {
expect(multiplesThreeAndFive(1000)).toBe(233168)
})
})