replace if tests with assert

This commit is contained in:
Michael C
2021-07-07 03:47:08 -04:00
parent e94d1d4bae
commit 178ed1e5af
22 changed files with 1344 additions and 2041 deletions

View File

@@ -3,6 +3,7 @@ import {Done, getbaseURL} from '../utils';
import {db} from '../../src/databases/databases';
import {getHash} from '../../src/utils/getHash';
import {IDatabase} from '../../src/databases/IDatabase';
import assert from 'assert';
async function dbSponsorTimesAdd(db: IDatabase, videoID: string, startTime: number, endTime: number, UUID: string, category: string) {
const votes = 0,
@@ -57,7 +58,8 @@ describe('postPurgeAllSegments', function () {
}),
})
.then(async res => {
done(res.status === 403 ? undefined : res.status);
assert.strictEqual(res.status, 403);
done();
})
.catch(err => done(err));
});
@@ -74,7 +76,7 @@ describe('postPurgeAllSegments', function () {
}),
})
.then(async res => {
if (res.status !== 200) return done(`Status code was ${res.status}`);
assert.strictEqual(res.status, 200);
done(await dbSponsorTimesCompareExpect(db, 'vsegpurge01', 1) || await dbSponsorTimesCompareExpect(db, 'vseg-not-purged01', 0));
})
.catch(err => done(err));