mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
more tests
This commit is contained in:
parent
9c9c2a23cc
commit
2c32460a6e
2 changed files with 25 additions and 0 deletions
|
@ -2,6 +2,7 @@ const hashPrefixTester = require('../utils/hashPrefixTester.js');
|
|||
const getSegments = require('./getSkipSegments.js').cleanGetSegments;
|
||||
|
||||
const databases = require('../databases/databases.js');
|
||||
const logger = require('../utils/logger.js');
|
||||
const db = databases.db;
|
||||
|
||||
module.exports = async function (req, res) {
|
||||
|
|
|
@ -100,6 +100,30 @@ describe('getSegmentsByHash', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('Should return 404 for no hash', (done) => {
|
||||
request.get(utils.getbaseURL()
|
||||
+ '/api/skipSegments/?categories=["shilling"]', null,
|
||||
(err, res, body) => {
|
||||
if (err) done("Couldn't call endpoint");
|
||||
else if (res.statusCode !== 404) done("expected 404, got " + res.statusCode);
|
||||
else {
|
||||
done(); // pass
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Should return 500 for bad format categories', (done) => { // should probably be 400
|
||||
request.get(utils.getbaseURL()
|
||||
+ '/api/skipSegments/?categories=shilling', null,
|
||||
(err, res, body) => {
|
||||
if (err) done("Couldn't call endpoint");
|
||||
else if (res.statusCode !== 500) done("expected 500 got " + res.statusCode);
|
||||
else {
|
||||
done(); // pass
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to get multiple videos', (done) => {
|
||||
request.get(utils.getbaseURL()
|
||||
+ '/api/skipSegments/fdaf?categories=["sponsor","intro"]', null,
|
||||
|
|
Loading…
Reference in a new issue