diff --git a/spec/helpers/emoji_helper_spec.rb b/spec/helpers/emoji_helper_spec.rb index 7dec3b3c55d..a8b13a9ccbc 100644 --- a/spec/helpers/emoji_helper_spec.rb +++ b/spec/helpers/emoji_helper_spec.rb @@ -4,6 +4,13 @@ require 'rails_helper' describe EmojiHelper do + before do + Plugin::CustomEmoji.clear_cache + end + + after do + Plugin::CustomEmoji.clear_cache + end describe "emoji_codes_to_img" do it "replaces emoji codes by images" do @@ -13,8 +20,6 @@ describe EmojiHelper do replaced_str = helper.emoji_codes_to_img(str) expect(replaced_str).to eq("This is a good day \"xxxxxx\" \"woman\" \"man:t4\"") - - Plugin::CustomEmoji.unregister("xxxxxx") end it "doesn't replace if code doesn't exist" do @@ -24,5 +29,4 @@ describe EmojiHelper do expect(replaced_str).to eq("This is a good day \"woman\" :foo: :bar:t4: :man:t8:") end end - end diff --git a/test/javascripts/acceptance/emoji-picker-test.js b/test/javascripts/acceptance/emoji-picker-test.js index 71e06e13215..fac37414a6e 100644 --- a/test/javascripts/acceptance/emoji-picker-test.js +++ b/test/javascripts/acceptance/emoji-picker-test.js @@ -3,6 +3,10 @@ import { IMAGE_VERSION as v } from "pretty-text/emoji/version"; acceptance("EmojiPicker", { loggedIn: true, + beforeEach() { + const store = Discourse.__container__.lookup("service:emoji-store"); + store.reset(); + }, afterEach() { const store = Discourse.__container__.lookup("service:emoji-store"); store.reset(); diff --git a/test/javascripts/controllers/preferences-account-test.js b/test/javascripts/controllers/preferences-account-test.js index a0a8ae38409..f953fb0332b 100644 --- a/test/javascripts/controllers/preferences-account-test.js +++ b/test/javascripts/controllers/preferences-account-test.js @@ -7,27 +7,26 @@ QUnit.test("updating of associated accounts", function(assert) { enable_google_oauth2_logins: true }, model: EmberObject.create({ + id: 70, second_factor_enabled: true, is_anonymous: true }), + currentUser: EmberObject.create({ + id: 1234, + }), site: EmberObject.create({ isMobileDevice: false }) }); - controller.set("canCheckEmails", false); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); controller.set("model.second_factor_enabled", false); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); controller.set("model.is_anonymous", false); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); - controller.set("canCheckEmails", true); - + controller.set("model.id", 1234); assert.equal(controller.get("canUpdateAssociatedAccounts"), true); }); diff --git a/test/javascripts/lib/emoji-store-test.js b/test/javascripts/lib/emoji-store-test.js index f0c521a58f5..3a137ed4c92 100644 --- a/test/javascripts/lib/emoji-store-test.js +++ b/test/javascripts/lib/emoji-store-test.js @@ -1,4 +1,8 @@ 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();