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
Jarek Radosz 1b52cdedb1
DEV: Move more tests into modules (#11119)
Models, services, mixins, utilities, and most of the controllers
2020-11-05 20:23:28 +01:00

37 lines
1.1 KiB
JavaScript

import { test } from "qunit";
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
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.equal(this.emojiStore.diversity, 1);
});
test("diversity", function (assert) {
this.emojiStore.diversity = 2;
assert.equal(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"]);
});
});