This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/unit/lib/emoji-store-test.js
2021-11-08 10:26:28 +01:00

37 lines
1.1 KiB
JavaScript

import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
discourseModule("Unit | Utility | emoji-emojiStore", function (hooks) {
hooks.beforeEach(function () {
this.emojiStore = this.container.lookup("service:emoji-store");
this.emojiStore.reset();
});
hooks.afterEach(function () {
this.emojiStore.reset();
});
test("defaults", function (assert) {
assert.deepEqual(this.emojiStore.favorites, []);
assert.strictEqual(this.emojiStore.diversity, 1);
});
test("diversity", function (assert) {
this.emojiStore.diversity = 2;
assert.strictEqual(this.emojiStore.diversity, 2);
});
test("favorites", function (assert) {
this.emojiStore.favorites = ["smile"];
assert.deepEqual(this.emojiStore.favorites, ["smile"]);
});
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"]);
});
});