mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 22:47:12 +03:00
Update tests to use promises
This commit is contained in:
@@ -7,7 +7,7 @@ describe('postVideoSponsorTime (Old submission method)', () => {
|
||||
it('Should be able to submit a time (GET)', (done: Done) => {
|
||||
fetch(getbaseURL()
|
||||
+ "/api/postVideoSponsorTimes?videoID=dQw4w9WgXcQ&startTime=1&endTime=10&userID=test")
|
||||
.then(res => {
|
||||
.then(async res => {
|
||||
if (res.status === 200) {
|
||||
let row = await db.prepare('get', "SELECT startTime, endTime, category FROM sponsorTimes WHERE videoID = ?", ["dQw4w9WgXcQ"]);
|
||||
if (row.startTime === 1 && row.endTime === 10 && row.category === "sponsor") {
|
||||
@@ -30,7 +30,7 @@ describe('postVideoSponsorTime (Old submission method)', () => {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
.then(async res => {
|
||||
if (res.status === 200) {
|
||||
let row = await db.prepare('get', "SELECT startTime, endTime, category FROM sponsorTimes WHERE videoID = ?", ["dQw4w9WgXcE"]);
|
||||
if (row.startTime === 1 && row.endTime === 11 && row.category === "sponsor") {
|
||||
@@ -48,7 +48,7 @@ describe('postVideoSponsorTime (Old submission method)', () => {
|
||||
it('Should return 400 for missing params', (done: Done) => {
|
||||
fetch(getbaseURL()
|
||||
+ "/api/postVideoSponsorTimes?startTime=1&endTime=10&userID=test")
|
||||
.then(res => {
|
||||
.then(async res => {
|
||||
if (res.status === 400) done();
|
||||
else done("Status code was: " + res.status);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user