mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-09 04:57:04 +03:00
fix eslint-errors
This commit is contained in:
@@ -29,7 +29,7 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status !== 200) done("non 200 status code, was " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should return 404 if no segments are found even if a video for the given hash is known', (done: Done) => {
|
||||
@@ -42,7 +42,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done("Response had videos");
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to get an empty array if no videos', (done: Done) => {
|
||||
@@ -55,7 +55,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done("non empty array returned");
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to get an empty array if only hidden videos', (done: Done) => {
|
||||
@@ -68,7 +68,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done("non empty array returned");
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should return 400 prefix too short', (done: Done) => {
|
||||
@@ -77,11 +77,11 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status !== 400) done("non 400 status code, was " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should return 400 prefix too long', (done: Done) => {
|
||||
let prefix = new Array(50).join('1');
|
||||
const prefix = new Array(50).join('1');
|
||||
if (prefix.length <= 32) { // default value, config can change this
|
||||
done('failed to generate a long enough string for the test ' + prefix.length);
|
||||
return;
|
||||
@@ -91,7 +91,7 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status !== 400) done("non 400 status code, was " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should not return 400 prefix in range', (done: Done) => {
|
||||
@@ -100,7 +100,7 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status === 400) done("prefix length 5 gave 400 " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should return 404 for no hash', (done: Done) => {
|
||||
@@ -109,7 +109,7 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status !== 404) done("expected 404, got " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should return 400 for bad format categories', (done: Done) => {
|
||||
@@ -118,7 +118,7 @@ describe('getSegmentsByHash', () => {
|
||||
if (res.status !== 400) done("expected 400 got " + res.status);
|
||||
else done(); // pass
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to get multiple videos', (done: Done) => {
|
||||
@@ -133,7 +133,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done();
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to get 200 for no categories (default sponsor)', (done: Done) => {
|
||||
@@ -151,7 +151,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done();
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to get 200 for no categories (default sponsor) for a non YouTube service', (done: Done) => {
|
||||
@@ -166,7 +166,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done();
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should only return one segment when fetching highlight segments', (done: Done) => {
|
||||
@@ -180,11 +180,11 @@ describe('getSegmentsByHash', () => {
|
||||
else done();
|
||||
}
|
||||
})
|
||||
.catch(err => done("Couldn't call endpoint"));
|
||||
.catch(() => done("Couldn't call endpoint"));
|
||||
});
|
||||
|
||||
it('Should be able to post a segment and get it using endpoint', (done: Done) => {
|
||||
let testID = 'abc123goodVideo';
|
||||
const testID = 'abc123goodVideo';
|
||||
fetch(getbaseURL() + "/api/postVideoSponsorTimes", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -212,7 +212,7 @@ describe('getSegmentsByHash', () => {
|
||||
else done();
|
||||
}
|
||||
})
|
||||
.catch(err => done("(get) Couldn't call endpoint"));
|
||||
.catch(() => done("(get) Couldn't call endpoint"));
|
||||
} else {
|
||||
done("(post) non 200 status code, was " + res.status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user