mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 07:29:47 +08:00

* chore: Switch to Node 20 + Vitest * chore: migrate to vitest mock functions * chore: code style (switch to prettier) * test: re-enable long-running test Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime! see #1193 * chore: code style * chore: fix failing tests * Updated Documentation in README.md * Update contribution guidelines to state usage of Prettier * fix: set prettier printWidth back to 80 * chore: apply updated code style automatically * fix: set prettier line endings to lf again * chore: apply updated code style automatically --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
18 lines
570 B
JavaScript
18 lines
570 B
JavaScript
import { isPronic } from '../IsPronic'
|
|
|
|
const pronicNumbers = [
|
|
0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306,
|
|
342, 380, 420, 462, 506, 552, 600, 650, 702, 756, 812, 870, 930, 992, 1056,
|
|
1122, 1190, 1260, 1332, 1406, 1482, 1560, 1640, 1722, 1806, 1892, 1980, 2070,
|
|
2162, 2256, 2352, 2450, 2550
|
|
]
|
|
|
|
describe('Testing isPronic function', () => {
|
|
for (let i = 0; i <= 2500; i++) {
|
|
it('should return true', () => {
|
|
const isPronicNumber = isPronic(i)
|
|
expect(isPronicNumber).toBe(pronicNumbers.includes(i))
|
|
})
|
|
}
|
|
})
|