Skip to content
Extraits de code Groupes Projets
Valider c51e24c0 rédigé par Will Hunt's avatar Will Hunt
Parcourir les fichiers

Fix linting

parent 0bcbe453
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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,
......
......@@ -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);
});
});
});
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter