mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Fix some more flaky tests (#9384)
Includes: * DEV: Don't overwrite a computed property in test
This commit is contained in:
parent
6171141211
commit
874999941a
|
@ -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 <img src=\"/public/xxxxxx.png\" title=\"xxxxxx\" class=\"emoji\" alt=\"xxxxxx\"> <img src=\"/images/emoji/twitter/woman.png?v=#{Emoji::EMOJI_VERSION}\" title=\"woman\" class=\"emoji\" alt=\"woman\"> <img src=\"/images/emoji/twitter/man/4.png?v=#{Emoji::EMOJI_VERSION}\" title=\"man:t4\" class=\"emoji\" alt=\"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 <img src=\"/images/emoji/twitter/woman.png?v=#{Emoji::EMOJI_VERSION}\" title=\"woman\" class=\"emoji\" alt=\"woman\"> :foo: :bar:t4: :man:t8:")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user