2020-07-29 01:07:33 +08:00
|
|
|
import { discourseModule } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
discourseModule("lib:emoji-emojiStore", {
|
2020-04-08 18:46:43 +08:00
|
|
|
beforeEach() {
|
2020-07-29 01:07:33 +08:00
|
|
|
this.emojiStore = this.container.lookup("service:emoji-store");
|
|
|
|
this.emojiStore.reset();
|
2020-04-08 18:46:43 +08:00
|
|
|
},
|
2019-08-16 17:47:03 +08:00
|
|
|
afterEach() {
|
2020-07-29 01:07:33 +08:00
|
|
|
this.emojiStore.reset();
|
2019-08-16 17:47:03 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-29 01:07:33 +08:00
|
|
|
QUnit.test("defaults", function(assert) {
|
|
|
|
assert.deepEqual(this.emojiStore.favorites, []);
|
|
|
|
assert.equal(this.emojiStore.diversity, 1);
|
2019-08-16 17:47:03 +08:00
|
|
|
});
|
|
|
|
|
2020-07-29 01:07:33 +08:00
|
|
|
QUnit.test("diversity", function(assert) {
|
|
|
|
this.emojiStore.diversity = 2;
|
|
|
|
assert.equal(this.emojiStore.diversity, 2);
|
2019-08-16 17:47:03 +08:00
|
|
|
});
|
|
|
|
|
2020-07-29 01:07:33 +08:00
|
|
|
QUnit.test("favorites", function(assert) {
|
|
|
|
this.emojiStore.favorites = ["smile"];
|
|
|
|
assert.deepEqual(this.emojiStore.favorites, ["smile"]);
|
2019-08-16 17:47:03 +08:00
|
|
|
});
|
|
|
|
|
2020-07-29 01:07:33 +08:00
|
|
|
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"]);
|
2019-08-16 17:47:03 +08:00
|
|
|
});
|