fix typos

This commit is contained in:
Michael C 2021-07-07 16:44:05 -04:00
parent 7d62fcd8cc
commit 4a835d5306
No known key found for this signature in database
GPG key ID: FFB04FB3B878B7B4
3 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ const mergeLocks = (source: DBLock[]) => {
const destMatch = dest.find(s => s.videoID === obj.videoID);
if (destMatch) {
// override longer reason
if (destMatch.reason.length > obj.reason.length) destMatch.reason = obj.reason;
if (obj.reason.length > destMatch.reason.length) destMatch.reason = obj.reason;
// push to categories
destMatch.categories.push(obj.category);
} else {

View file

@ -11,7 +11,7 @@ describe('getLockCategories', () => {
const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason") VALUES (?, ?, ?, ?)';
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLock-1', 'sponsor', '1-short']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLock-1', 'interaction', '2-longer-reason']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLock-1', 'interaction', '1-longer-reason']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLock-2', 'preview', '2-reason']);

View file

@ -9,9 +9,9 @@ describe('getLockCategoriesByHash', () => {
const insertVipUserQuery = 'INSERT INTO "vipUsers" ("userID") VALUES (?)';
await db.prepare("run", insertVipUserQuery, [getHash("VIPUser-getLockCategories")]);
const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reaspm", "hashedVideoID") VALUES (?, ?, ?, ?)';
const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason", "hashedVideoID") VALUES (?, ?, ?, ?, ?)';
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLockHash-1', 'sponsor', '1-reason-short', '67a654898fda3a5541774aea345796c7709982bb6018cb08d22a18eeddccc1d0']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLockHash-1', 'interaction', '1-longer-reason', '67a654898fda3a5541774aea345796c7709982bb6018cb08d22a18eeddccc1d0']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLockHash-1', 'interaction', '1-reason-longer', '67a654898fda3a5541774aea345796c7709982bb6018cb08d22a18eeddccc1d0']);
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'getLockHash-2', 'preview', '2-reason', 'dff09120437b4bd594dffae5f3cde3cfc5f6099fb01d0ef4051919b2908d9a50']);
@ -22,7 +22,7 @@ describe('getLockCategoriesByHash', () => {
await db.prepare("run", insertLockCategoryQuery, [getHash("VIPUser-getLockCategories"), 'fakehash-2', 'preview', 'fake2-short', 'b05acd1cd6ec7dffe5ffea64ada91ae7469d6db2ce21c7e30ad7fa62075d450']);
});
it('Database should be greater or equal to version 18', async () => {
it('Database should be greater or equal to version 20', async () => {
const version = (await db.prepare('get', 'SELECT key, value FROM config where key = ?', ['version'])).value;
if (version >= 20) return;
else return 'Version isn\'t greater than 20. Version is ' + version;
@ -45,7 +45,7 @@ describe('getLockCategoriesByHash', () => {
done(`Returned incorrect category "${data[0].categories[0]}"`);
} else if (data[0].categories[1] !== "interaction") {
done(`Returned incorrect category "${data[0].categories[1]}"`);
} else if (data[0].reason !== "1-longer-reason") {
} else if (data[0].reason !== "1-reason-longer") {
done(`Returned incorrect reason "${data[0].reason}"`);
} else {
done(); // pass