mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Add Zeller's Congruence Algorithm in Math (#996)
This commit is contained in:
17
Maths/test/ZellersCongruenceAlgorithm.test.js
Normal file
17
Maths/test/ZellersCongruenceAlgorithm.test.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { zellersCongruenceAlgorithm } from '../ZellersCongruenceAlgorithm'
|
||||
|
||||
function testZeller (day, month, year, expected) {
|
||||
test('Testing on ' + day + '/' + month + '/' + year, () => {
|
||||
expect(zellersCongruenceAlgorithm(day, month, year)).toBe(expected)
|
||||
})
|
||||
}
|
||||
|
||||
test('Testing on this/should/throw', () => {
|
||||
expect(() => {
|
||||
zellersCongruenceAlgorithm('this', 'should', 'error')
|
||||
}).toThrowError(new TypeError('Arguments are not all numbers.'))
|
||||
})
|
||||
testZeller(25, 1, 2013, 'Friday')
|
||||
testZeller(26, 1, 2013, 'Saturday')
|
||||
testZeller(16, 4, 2022, 'Saturday')
|
||||
testZeller(25, 4, 2022, 'Monday')
|
Reference in New Issue
Block a user