DEV: Fix some more flaky tests (#9384)

Includes:
* DEV: Don't overwrite a computed property in test
This commit is contained in:
Jarek Radosz 2020-04-08 12:46:43 +02:00 committed by GitHub
parent 6171141211
commit 874999941a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 9 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);
});

View File

@ -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();