discourse/test/javascripts/unit/lib/emoji-store-test.js
Robin Ward 445d6ba45f REFACTOR: Move qunit tests to a different directory structure
This structure is closer to how ember-cli expects tests to be placed. It
is not their final position, just the first step towards it.
2020-09-30 10:36:49 -04:00

35 lines
977 B
JavaScript

import { discourseModule } from "helpers/qunit-helpers";
discourseModule("lib:emoji-emojiStore", {
beforeEach() {
this.emojiStore = this.container.lookup("service:emoji-store");
this.emojiStore.reset();
},
afterEach() {
this.emojiStore.reset();
},
});
QUnit.test("defaults", function (assert) {
assert.deepEqual(this.emojiStore.favorites, []);
assert.equal(this.emojiStore.diversity, 1);
});
QUnit.test("diversity", function (assert) {
this.emojiStore.diversity = 2;
assert.equal(this.emojiStore.diversity, 2);
});
QUnit.test("favorites", function (assert) {
this.emojiStore.favorites = ["smile"];
assert.deepEqual(this.emojiStore.favorites, ["smile"]);
});
QUnit.test("track", function (assert) {
this.emojiStore.track("woman:t4");
assert.deepEqual(this.emojiStore.favorites, ["woman:t4"]);
this.emojiStore.track("otter");
this.emojiStore.track(":otter:");
assert.deepEqual(this.emojiStore.favorites, ["otter", "woman:t4"]);
});