Work around flaky test

This commit is contained in:
Calvin Montgomery 2022-09-21 22:21:16 -07:00
parent 99740a3673
commit 306e3adde8
2 changed files with 6 additions and 2 deletions

View file

@ -362,7 +362,6 @@ describe('KickbanModule', () => {
);
});
// TODO: for whatever reason, this test is flaky
it('inserts a valid IPv6 ban', done => {
const longIP = require('../../lib/utilities').expandIPv6('::abcd');

View file

@ -404,7 +404,12 @@ KickBanModule.prototype.banAll = async function banAll(
);
if (!await dbIsNameBanned(chan.name, name)) {
promises.push(this.banName(actor, name, reason));
promises.push(this.banName(actor, name, reason).catch(error => {
// TODO: banning should be made idempotent, not throw an error
if (!/already banned/.test(error.message)) {
throw error;
}
}));
}
await Promise.all(promises);