fix tests and linting

This commit is contained in:
Michael C
2021-07-22 17:50:39 -04:00
parent dbc8558ec8
commit 87727ef360
5 changed files with 35 additions and 33 deletions

View File

@@ -341,8 +341,8 @@ describe("getSkipSegments", () => {
.catch(err => done(err)); .catch(err => done(err));
}); });
it('Should get 400 if no videoID passed in', (done: Done) => { it("Should get 400 if no videoID passed in", (done: Done) => {
fetch(getbaseURL() + '/api/skipSegments') fetch(`${getbaseURL()}/api/skipSegments`)
.then(async res => { .then(async res => {
assert.strictEqual(res.status, 400); assert.strictEqual(res.status, 400);
done(); done();

View File

@@ -314,8 +314,8 @@ describe("getUserID", () => {
.catch(err => done(err)); .catch(err => done(err));
}); });
it('should return 400 if no username parameter specified', (done: Done) => { it("should return 400 if no username parameter specified", (done: Done) => {
fetch(getbaseURL() + '/api/userID') fetch(`${getbaseURL()}/api/userID`)
.then(res => { .then(res => {
assert.strictEqual(res.status, 400); assert.strictEqual(res.status, 400);
done(); done();

View File

@@ -82,11 +82,11 @@ describe("postPurgeAllSegments", function () {
.catch(err => done(err)); .catch(err => done(err));
}); });
it('Should return 400 if missing body', function (done: Done) { it("Should return 400 if missing body", function (done: Done) {
fetch(`${baseURL}${route}`, { fetch(`${baseURL}${route}`, {
method: 'POST', method: "POST",
headers: { headers: {
'Content-Type': 'application/json', "Content-Type": "application/json",
} }
}) })
.then(async res => { .then(async res => {

View File

@@ -584,7 +584,10 @@ describe("postSkipSegments", () => {
.then(async res => { .then(async res => {
assert.strictEqual(res.status, 403); assert.strictEqual(res.status, 403);
const errorMessage = await res.text(); const errorMessage = await res.text();
assert.strictEqual(errorMessage, "Reason01"); const reason = "Reason01";
const userID = "09dee632bfbb1acc9fda3169cc14b46e459b45cee4f4449be305590e612b5eb7"
const expected = `Submission rejected due to a warning from a moderator. This means that we noticed you were making some common mistakes that are not malicious, and we just want to clarify the rules. Could you please send a message in Discord or Matrix so we can further help you? Your userID is ${userID}. Warning reason: ${reason}`;
assert.strictEqual(errorMessage, expected);
done(); done();
}) })
.catch(err => done(err)); .catch(err => done(err));

View File

@@ -99,12 +99,11 @@ describe("postWarning", () => {
.catch(err => done(err)); .catch(err => done(err));
}); });
it('Should return 400 if missing body', (done: Done) => { it("Should return 400 if missing body", (done: Done) => {
fetch(getbaseURL() fetch(`${getbaseURL()}/api/warnUser`, {
+ "/api/warnUser", { method: "POST",
method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', "Content-Type": "application/json",
} }
}) })
.then(async res => { .then(async res => {