Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2affaa1

Browse files
fix: Fix unit tests for zero and negative numbers
1 parent 148ef6c commit 2affaa1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎Maths/test/MobiusFunction.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ describe('Testing mobius function', () => {
99
})
1010
}
1111

12-
it('should not support negative numbers', () => {
13-
const actualMessage = mobiusFunction(-1)
14-
expect(actualMessage).toBe('Number must be greater than zero.')
12+
it('should throw error when supplied negative numbers', () => {
13+
expect(() => {mobiusFunction(-1)}).toThrow(Error)
1514
})
1615

17-
it('should not support zero', () => {
18-
const actualMessage = mobiusFunction(0)
19-
expect(actualMessage).toBe('Number must be greater than zero.')
16+
it('should throw error when supplied zero', () => {
17+
expect(() => {mobiusFunction(0)}).toThrow(Error)
2018
})
2119
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /