From c51e24c0d16d24097646047e56d1786d86316b0d Mon Sep 17 00:00:00 2001 From: Will Hunt <half-shot@molrams.com> Date: Sun, 10 Sep 2017 14:06:52 +0100 Subject: [PATCH] Fix linting --- src/db/dbdataemoji.ts | 6 ++--- test/test_store.ts | 58 +++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/db/dbdataemoji.ts b/src/db/dbdataemoji.ts index e047757..47dd4de 100644 --- a/src/db/dbdataemoji.ts +++ b/src/db/dbdataemoji.ts @@ -20,8 +20,8 @@ export class DbGuildEmoji implements IDbData { WHERE emoji_id = $id`, { $id: params.emoji_id, }).then((row) => { - this.Result = row != undefined; - if(this.Result) { + this.Result = row !== undefined; + if (this.Result) { this.EmojiId = row.emoji_id; this.GuildId = row.guild_id; this.Name = row.name; @@ -50,7 +50,7 @@ export class DbGuildEmoji implements IDbData { public Update(store: DiscordStore) { // Ensure this has incremented by 1 for Insert+Update operations. - this.UpdatedAt = new Date().getTime()+1; + this.UpdatedAt = new Date().getTime() + 1; return store.db.runAsync(` UPDATE guild_emoji SET name = $name, diff --git a/test/test_store.ts b/test/test_store.ts index 24b1689..1a0f3aa 100644 --- a/test/test_store.ts +++ b/test/test_store.ts @@ -46,43 +46,43 @@ describe("DiscordStore", () => { return store.Insert(emoji); })).to.eventually.be.fulfilled; }); - it("should get successfully", async function() { + it("should get successfully", async () => { const store = new DiscordStore(":memory:"); await store.init(); - const insert_emoji = new DbGuildEmoji(); - insert_emoji.EmojiId = "123"; - insert_emoji.GuildId = "456"; - insert_emoji.Name = "TestEmoji"; - insert_emoji.MxcUrl = "TestUrl"; - await store.Insert(insert_emoji); - const get_emoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); - Chai.assert.equal(get_emoji.Name, "TestEmoji"); - Chai.assert.equal(get_emoji.MxcUrl, "TestUrl"); + const insertEmoji = new DbGuildEmoji(); + insertEmoji.EmojiId = "123"; + insertEmoji.GuildId = "456"; + insertEmoji.Name = "TestEmoji"; + insertEmoji.MxcUrl = "TestUrl"; + await store.Insert(insertEmoji); + const getEmoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); + Chai.assert.equal(getEmoji.Name, "TestEmoji"); + Chai.assert.equal(getEmoji.MxcUrl, "TestUrl"); }); - it("should not return nonexistant emoji", async function() { + it("should not return nonexistant emoji", async () => { const store = new DiscordStore(":memory:"); await store.init(); - const get_emoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); - Chai.assert.isFalse(get_emoji.Result); + const getEmoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); + Chai.assert.isFalse(getEmoji.Result); }); - it("should update successfully", async function() { + it("should update successfully", async () => { const store = new DiscordStore(":memory:"); await store.init(); - const insert_emoji = new DbGuildEmoji(); - insert_emoji.EmojiId = "123"; - insert_emoji.GuildId = "456"; - insert_emoji.Name = "TestEmoji"; - insert_emoji.MxcUrl = "TestUrl"; - await store.Insert(insert_emoji); - insert_emoji.EmojiId = "123"; - insert_emoji.GuildId = "456"; - insert_emoji.Name = "TestEmoji2"; - insert_emoji.MxcUrl = "NewURL"; - await store.Update(insert_emoji); - const get_emoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); - Chai.assert.equal(get_emoji.Name, "TestEmoji2"); - Chai.assert.equal(get_emoji.MxcUrl, "NewURL"); - Chai.assert.notEqual(get_emoji.CreatedAt,get_emoji.UpdatedAt); + const insertEmoji = new DbGuildEmoji(); + insertEmoji.EmojiId = "123"; + insertEmoji.GuildId = "456"; + insertEmoji.Name = "TestEmoji"; + insertEmoji.MxcUrl = "TestUrl"; + await store.Insert(insertEmoji); + insertEmoji.EmojiId = "123"; + insertEmoji.GuildId = "456"; + insertEmoji.Name = "TestEmoji2"; + insertEmoji.MxcUrl = "NewURL"; + await store.Update(insertEmoji); + const getEmoji = await store.Get(DbGuildEmoji, {emoji_id: "123"}); + Chai.assert.equal(getEmoji.Name, "TestEmoji2"); + Chai.assert.equal(getEmoji.MxcUrl, "NewURL"); + Chai.assert.notEqual(getEmoji.CreatedAt, getEmoji.UpdatedAt); }); }); }); -- GitLab