discourse/test/javascripts/lib/emoji-store-test.js
Jarek Radosz 874999941a
DEV: Fix some more flaky tests (#9384)
Includes:
* DEV: Don't overwrite a computed property in test
2020-04-08 12:46:43 +02:00

38 lines
1.1 KiB
JavaScript

QUnit.module("lib:emoji-store", {
beforeEach() {
const store = Discourse.__container__.lookup("service:emoji-store");
store.reset();
},
afterEach() {
const store = Discourse.__container__.lookup("service:emoji-store");
store.reset();
}
});
QUnit.test("defaults", assert => {
const store = Discourse.__container__.lookup("service:emoji-store");
assert.deepEqual(store.favorites, []);
assert.equal(store.diversity, 1);
});
QUnit.test("diversity", assert => {
const store = Discourse.__container__.lookup("service:emoji-store");
store.diversity = 2;
assert.equal(store.diversity, 2);
});
QUnit.test("favorites", assert => {
const store = Discourse.__container__.lookup("service:emoji-store");
store.favorites = ["smile"];
assert.deepEqual(store.favorites, ["smile"]);
});
QUnit.test("track", assert => {
const store = Discourse.__container__.lookup("service:emoji-store");
store.track("woman:t4");
assert.deepEqual(store.favorites, ["woman:t4"]);
store.track("otter");
store.track(":otter:");
assert.deepEqual(store.favorites, ["otter", "woman:t4"]);
});