Add test for calculateReloaded
All checks were successful
discord bot tests / discord bot tests (push) Successful in 10s

This commit is contained in:
SileNce5k 2024-10-22 11:52:29 +02:00
parent 000f7e969c
commit 4ca13712ed
Signed by: SileNce
GPG key ID: B0A142BB4291B204

View 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])
});
}