Add test for calculateReloaded
All checks were successful
discord bot tests / discord bot tests (push) Successful in 10s
All checks were successful
discord bot tests / discord bot tests (push) Successful in 10s
This commit is contained in:
parent
000f7e969c
commit
4ca13712ed
1 changed files with 26 additions and 0 deletions
26
tests/calculateReloaded.test.js
Normal file
26
tests/calculateReloaded.test.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const calculateReloaded = require('../util/calculateReloaded')
|
||||
|
||||
let client = {commands: new Map()};
|
||||
for(let i = 0; i < 10; i++){
|
||||
client.commands.set(i, i * 420);
|
||||
}
|
||||
let beforeSizes = [0, 12, 10, 9, 11, 6, 104];
|
||||
let expectedResults = [
|
||||
`10 modules were added, and a total of 10 were reloaded.`,
|
||||
`10 modules were reloaded after 2 were disabled.`,
|
||||
`10 modules were reloaded.`,
|
||||
`1 module was added, and a total of 10 were reloaded.`,
|
||||
`10 modules were reloaded after 1 module was deleted.`,
|
||||
`4 modules were added, and a total of 10 were reloaded.`,
|
||||
`10 modules were reloaded after 94 were disabled.`
|
||||
]
|
||||
|
||||
if(beforeSizes.length != expectedResults.length) throw "Error: beforeSizes and expectedResults are unequal length"
|
||||
|
||||
for(let i = 0; i < beforeSizes.length; i++){
|
||||
test('calculateReloaded test', () => {
|
||||
expect(calculateReloaded(beforeSizes[i], client)).toBe(expectedResults[i])
|
||||
|
||||
});
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue