diff --git a/app/assets/javascripts/discourse-common/addon/lib/object.js b/app/assets/javascripts/discourse-common/addon/lib/object.js
index 85a9f5867f8..bea2109a1f8 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/object.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/object.js
@@ -53,6 +53,8 @@ export function deepEqual(obj1, obj2) {
}
}
return true;
+ } else {
+ return false;
}
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/categories-test.js b/app/assets/javascripts/discourse/tests/acceptance/categories-test.js
index d5f539377d4..3964d78cbf5 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/categories-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/categories-test.js
@@ -153,12 +153,14 @@ acceptance("Categories - preloadStore handling", function () {
await visit(`/categories`);
- assert.true(
- PreloadStore.get("topic_list") === undefined,
+ assert.strictEqual(
+ PreloadStore.get("topic_list"),
+ undefined,
`topic_list is removed from preloadStore for ${style}`
);
- assert.true(
- PreloadStore.get("categories_list") === undefined,
+ assert.strictEqual(
+ PreloadStore.get("categories_list"),
+ undefined,
`topic_list is removed from preloadStore for ${style}`
);
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js
index ba9554e2b90..9d61754ddd3 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js
@@ -16,7 +16,10 @@ acceptance("CategoryChooser", function (needs) {
await click("#create-topic");
await categoryChooser.expand();
- assert.ok(categoryChooser.rowByIndex(0).name() !== "uncategorized");
+ assert.notStrictEqual(
+ categoryChooser.rowByIndex(0).name(),
+ "uncategorized"
+ );
});
test("prefill category when category_id is set", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js
index 6479ae38ea1..17246321922 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js
@@ -20,7 +20,7 @@ acceptance("Composer - Edit conflict", function (needs) {
".d-editor-input",
"hello world hello world hello world hello world hello world"
);
- assert.ok(!lastBody.includes("originalText"));
+ assert.false(lastBody.includes("originalText"));
});
test("Should send originalText when editing a reply", async function (assert) {
@@ -31,6 +31,6 @@ acceptance("Composer - Edit conflict", function (needs) {
".d-editor-input",
"hello world hello world hello world hello world hello world"
);
- assert.ok(lastBody.includes("originalText"));
+ assert.true(lastBody.includes("originalText"));
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
index b7fb332ee91..66afc1e72c1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
@@ -466,11 +466,12 @@ acceptance("Composer", function (needs) {
await fillIn(".d-editor-input", "enqueue this content please");
await click("#reply-control button.create");
- assert.ok(
- query(".topic-post:last-of-type .cooked p").innerText !==
+ assert
+ .dom(".topic-post:last-of-type .cooked p")
+ .doesNotIncludeText(
"enqueue this content please",
- "it doesn't insert the post"
- );
+ "doesn't insert the post"
+ );
assert.dom(".d-modal").exists("pops up a modal");
await click(".d-modal__footer button");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
index a19d00d7fb9..82081dcb3d9 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
@@ -471,11 +471,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
"||a|b|\n|---|---|---|\n|1|2|3|\n",
"only the plain text table is pasted"
);
- assert.strictEqual(
- uppyEventFired,
- false,
- "uppy does not start uploading the file"
- );
+ assert.false(uppyEventFired, "uppy does not start uploading the file");
done();
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js
index 7dc0ed875be..4813e2f6f85 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js
@@ -32,7 +32,7 @@ acceptance("Do not disturb", function (needs) {
assert.dom(".do-not-disturb-modal").exists("modal to choose time appears");
let tiles = queryAll(".do-not-disturb-tile");
- assert.ok(tiles.length === 4, "There are 4 duration choices");
+ assert.strictEqual(tiles.length, 4, "There are 4 duration choices");
await click(tiles[0]);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js
index 12e1c44c2ae..62e6f4dc124 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js
@@ -98,8 +98,8 @@ acceptance("User notification schedule", function (needs) {
);
await selectKit(".day.Tuesday .ends-at .combobox").expand();
- assert.ok(
- !selectKit(".day.Tuesday .ends-at .combobox").rowByValue(1350).exists(),
+ assert.false(
+ selectKit(".day.Tuesday .ends-at .combobox").rowByValue(1350).exists(),
"End time options are limited to + 30 past start time"
);
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/dismiss-new-test.js b/app/assets/javascripts/discourse/tests/integration/components/dismiss-new-test.js
index c8d85633c58..99458ac52ca 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/dismiss-new-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/dismiss-new-test.js
@@ -113,8 +113,8 @@ module("Integration | Component | modal/dismiss-new", function (hooks) {
await click(".untrack [type='checkbox']");
await click("#dismiss-read-confirm");
- assert.strictEqual(state.dismissTopics, false);
- assert.strictEqual(state.dismissPosts, false);
- assert.strictEqual(state.untrack, true);
+ assert.false(state.dismissTopics);
+ assert.false(state.dismissPosts);
+ assert.true(state.untrack);
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.js b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.js
index e04ccb71a85..018bd591408 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-menu-test.js
@@ -72,7 +72,7 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await render(hbs``);
await open();
- assert.strictEqual(this.test, true);
+ assert.true(this.test);
});
test("@onClose", async function (assert) {
@@ -83,7 +83,7 @@ module("Integration | Component | FloatKit | d-menu", function (hooks) {
await open();
await close();
- assert.strictEqual(this.test, true);
+ assert.true(this.test);
});
test("-expanded class", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-tooltip-test.js b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-tooltip-test.js
index 3f3959d2e7b..5b48d0ee992 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-tooltip-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/float-kit/d-tooltip-test.js
@@ -66,7 +66,7 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
await hover();
- assert.strictEqual(this.test, true);
+ assert.true(this.test);
});
test("@onClose", async function (assert) {
@@ -77,7 +77,7 @@ module("Integration | Component | FloatKit | d-tooltip", function (hooks) {
await hover();
await close();
- assert.strictEqual(this.test, true);
+ assert.true(this.test);
});
test("-expanded class", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs
index 009945fb681..ca25c4aa3d1 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs
@@ -473,11 +473,10 @@ module("Integration | Component | plugin-outlet", function (hooks) {
1,
"console warn was called once"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `shouldDisplay` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the default message to the console"
);
});
@@ -506,34 +505,30 @@ module("Integration | Component | plugin-outlet", function (hooks) {
1,
"console warn was called once"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
sinon.match(/The 'shouldDisplay' is deprecated on this test/)
),
- true,
"logs the custom deprecation message to the console"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
sinon.match(
/deprecation id: discourse.plugin-connector.deprecated-arg.test/
)
),
- true,
"logs custom deprecation id"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
sinon.match(/deprecated since Discourse 3.3.0.beta4-dev/)
),
- true,
"logs deprecation since information"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
sinon.match(/removal in Discourse 3.4.0/)
),
- true,
"logs dropFrom information"
);
});
@@ -568,22 +563,20 @@ module("Integration | Component | plugin-outlet", function (hooks) {
1,
"console warn was called once"
);
- assert.strictEqual(
+ assert.false(
this.consoleWarnStub.calledWith(
sinon.match(
/deprecation id: discourse.deprecation-that-should-not-be-logged/
)
),
- false,
"does not log silence deprecation"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
sinon.match(
/deprecation id: discourse.plugin-connector.deprecated-arg/
)
),
- true,
"logs expected deprecation"
);
});
@@ -793,18 +786,16 @@ module(
2,
"console warn was called twice"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for @outletArgs.hello"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for this.hello"
);
});
@@ -827,18 +818,16 @@ module(
1,
"console warn was called once"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for @outletArgs.hello"
);
- assert.strictEqual(
+ assert.false(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/templates/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- false,
"does not log the message for this.hello"
);
});
@@ -867,18 +856,16 @@ module(
2,
"console warn was called twice"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for @outletArgs.hello"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [used on connector discourse/plugins/some-plugin/connectors/test-name/my-connector] [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for this.hello"
);
});
@@ -906,18 +893,16 @@ module(
2,
"console warn was called twice"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for @outletArgs.hello"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for this.hello"
);
});
@@ -941,11 +926,10 @@ module(
1,
"console warn was called twice"
);
- assert.strictEqual(
+ assert.true(
this.consoleWarnStub.calledWith(
"Deprecation notice: outlet arg `hello` is deprecated on the outlet `test-name` [deprecation id: discourse.plugin-connector.deprecated-arg]"
),
- true,
"logs the expected message for @outletArgs.hello"
);
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
index 49f4c6c124a..7d4d2270657 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js
@@ -43,10 +43,10 @@ module("Integration | Component | text-field", function (hooks) {
);
await fillIn(".tf-test", "hello");
- assert.ok(!this.called);
+ assert.false(this.called);
await fillIn(".tf-test", "new text");
- assert.ok(this.called);
+ assert.true(this.called);
assert.strictEqual(this.newValue, "new text");
});
@@ -64,10 +64,10 @@ module("Integration | Component | text-field", function (hooks) {
);
await fillIn(".tf-test", "old");
- assert.ok(!this.called);
+ assert.false(this.called);
await fillIn(".tf-test", "no longer old");
- assert.ok(this.called);
+ assert.true(this.called);
assert.strictEqual(this.newValue, "no longer old");
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/topic-list-item-test.js b/app/assets/javascripts/discourse/tests/integration/components/topic-list-item-test.js
index 3b1527229fa..b2c71e41cf9 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/topic-list-item-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/topic-list-item-test.js
@@ -3,7 +3,6 @@ import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-import { queryAll } from "discourse/tests/helpers/qunit-helpers";
module("Integration | Component | topic-list-item", function (hooks) {
setupRenderingTest(hooks);
@@ -31,8 +30,8 @@ module("Integration | Component | topic-list-item", function (hooks) {
/>
`);
- const checkboxes = queryAll("input.bulk-select");
- assert.ok(checkboxes[0].checked);
- assert.ok(!checkboxes[1].checked);
+ const checkboxes = [...document.querySelectorAll("input.bulk-select")];
+ assert.dom(checkboxes[0]).isChecked();
+ assert.dom(checkboxes[1]).isNotChecked();
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test-with-glimmer-post-menu-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test-with-glimmer-post-menu-test.js
index 550bc71ee22..784e6b5d2c3 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test-with-glimmer-post-menu-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test-with-glimmer-post-menu-test.js
@@ -4,12 +4,7 @@ import { click, render, triggerEvent } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
-import {
- count,
- exists,
- query,
- queryAll,
-} from "discourse/tests/helpers/qunit-helpers";
+import { count, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { i18n } from "discourse-i18n";
module(
@@ -49,8 +44,8 @@ module(
@model={{this.post}}
@args={{this.args}} />`);
- assert.ok(exists(".names"), "includes poster name");
- assert.ok(exists("a.post-date"), "includes post date");
+ assert.dom(".names").exists("includes poster name");
+ assert.dom("a.post-date").exists("includes post date");
});
test("post - links", async function (assert) {
@@ -161,6 +156,7 @@ module(
});
test("via-email without permission", async function (assert) {
+ this.rawEmailShown = false;
this.set("args", { via_email: true, canViewRawEmail: false });
this.set("showRawEmail", () => (this.rawEmailShown = true));
@@ -170,8 +166,8 @@ module(
);
await click(".post-info.via-email");
- assert.ok(
- !this.rawEmailShown,
+ assert.false(
+ this.rawEmailShown,
"clicking the envelope doesn't show the raw email"
);
});
@@ -190,6 +186,7 @@ module(
});
test("history without view permission", async function (assert) {
+ this.historyShown = false;
this.set("args", { version: 3, canViewEditHistory: false });
this.set("showHistory", () => (this.historyShown = true));
@@ -199,8 +196,8 @@ module(
);
await click(".post-info.edits");
- assert.ok(
- !this.historyShown,
+ assert.false(
+ this.historyShown,
`clicking the pencil doesn't show the history`
);
});
@@ -221,7 +218,7 @@ module(
await render(hbs`
`);
- assert.ok(exists(".read-state.read"));
+ assert.dom(".read-state.read").exists();
});
test(`unread indicator`, async function (assert) {
@@ -230,7 +227,7 @@ module(
await render(hbs`
`);
- assert.ok(exists(".read-state"));
+ assert.dom(".read-state").exists();
});
test("reply directly above (suppressed)", async function (assert) {
@@ -243,8 +240,8 @@ module(
await render(hbs`
`);
- assert.ok(!exists("a.reply-to-tab"), "hides the tab");
- assert.ok(!exists(".avoid-tab"), "doesn't have the avoid tab class");
+ assert.dom("a.reply-to-tab").doesNotExist("hides the tab");
+ assert.dom(".avoid-tab").doesNotExist("doesn't have the avoid tab class");
});
test("reply a few posts above (suppressed)", async function (assert) {
@@ -257,7 +254,7 @@ module(
await render(hbs`
`);
- assert.ok(exists("a.reply-to-tab"), "shows the tab");
+ assert.dom("a.reply-to-tab").exists("shows the tab");
assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class");
});
@@ -300,10 +297,9 @@ module(
`
);
- assert.ok(
- !exists(".topic-body .expand-hidden"),
- "button is not displayed"
- );
+ assert
+ .dom(".topic-body .expand-hidden")
+ .doesNotExist("button is not displayed");
});
test("expand first post", async function (assert) {
@@ -315,7 +311,7 @@ module(
);
await click(".topic-body .expand-post");
- assert.ok(!exists(".expand-post"), "button is gone");
+ assert.dom(".expand-post").doesNotExist("button is gone");
});
test("can't show admin menu when you can't manage", async function (assert) {
@@ -324,7 +320,7 @@ module(
await render(hbs`
`);
- assert.ok(!exists(".post-menu-area .show-post-admin-menu"));
+ assert.dom(".post-menu-area .show-post-admin-menu").doesNotExist();
});
test("show admin menu", async function (assert) {
@@ -784,7 +780,7 @@ module(
await render(hbs`
`);
- assert.ok(exists(".user-status-message"));
+ assert.dom(".user-status-message").exists();
});
test("doesn't show user status if disabled in site settings", async function (assert) {
@@ -800,7 +796,7 @@ module(
await render(hbs`
`);
- assert.notOk(exists(".user-status-message"));
+ assert.dom(".user-status-message").doesNotExist();
});
}
);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js
index b637dba6720..6ce8076c4e7 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.js
@@ -133,6 +133,7 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("via-email without permission", async function (assert) {
+ this.rawEmailShown = false;
this.set("args", { via_email: true, canViewRawEmail: false });
this.set("showRawEmail", () => (this.rawEmailShown = true));
@@ -142,8 +143,8 @@ module("Integration | Component | Widget | post", function (hooks) {
);
await click(".post-info.via-email");
- assert.ok(
- !this.rawEmailShown,
+ assert.false(
+ this.rawEmailShown,
"clicking the envelope doesn't show the raw email"
);
});
@@ -162,6 +163,7 @@ module("Integration | Component | Widget | post", function (hooks) {
});
test("history without view permission", async function (assert) {
+ this.historyShown = false;
this.set("args", { version: 3, canViewEditHistory: false });
this.set("showHistory", () => (this.historyShown = true));
@@ -171,9 +173,9 @@ module("Integration | Component | Widget | post", function (hooks) {
);
await click(".post-info.edits");
- assert.ok(
- !this.historyShown,
- `clicking the pencil doesn't show the history`
+ assert.false(
+ this.historyShown,
+ "clicking the pencil doesn't show the history"
);
});
diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/admin-customize-themes-show-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/admin-customize-themes-show-test.js
index df23dc89a6e..ec35962fed5 100644
--- a/app/assets/javascripts/discourse/tests/unit/controllers/admin-customize-themes-show-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/controllers/admin-customize-themes-show-test.js
@@ -62,9 +62,8 @@ module("Unit | Controller | admin-customize-themes-show", function (hooks) {
"controller:admin-customize-themes-show"
);
controller.setProperties({ model: theme });
- assert.deepEqual(
+ assert.true(
controller.hasSettings,
- true,
"sets the hasSettings property to true with settings"
);
});
@@ -80,9 +79,8 @@ module("Unit | Controller | admin-customize-themes-show", function (hooks) {
"controller:admin-customize-themes-show"
);
controller.setProperties({ model: theme });
- assert.deepEqual(
+ assert.false(
controller.hasSettings,
- false,
"sets the hasSettings property to true with settings"
);
});
diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js
index da3043920c1..f27ccceca4c 100644
--- a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js
@@ -23,15 +23,15 @@ module("Unit | Controller | preferences/account", function (hooks) {
},
});
- assert.strictEqual(controller.canUpdateAssociatedAccounts, false);
+ assert.false(controller.canUpdateAssociatedAccounts);
controller.set("model.second_factor_enabled", false);
- assert.strictEqual(controller.canUpdateAssociatedAccounts, false);
+ assert.false(controller.canUpdateAssociatedAccounts);
controller.set("model.is_anonymous", false);
- assert.strictEqual(controller.canUpdateAssociatedAccounts, false);
+ assert.false(controller.canUpdateAssociatedAccounts);
controller.set("model.id", 1234);
- assert.strictEqual(controller.canUpdateAssociatedAccounts, true);
+ assert.true(controller.canUpdateAssociatedAccounts);
});
});
diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js
index a4c7fc1c4cb..4b71492ae9d 100644
--- a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js
@@ -12,6 +12,6 @@ module("Unit | Controller | preferences/second-factor", function (hooks) {
"controller:preferences/second-factor"
);
- assert.strictEqual(controller.displayOAuthWarning, true);
+ assert.true(controller.displayOAuthWarning);
});
});
diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/user-notifications-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/user-notifications-test.js
index 542dace17ef..29a4e1d31ff 100644
--- a/app/assets/javascripts/discourse/tests/unit/controllers/user-notifications-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/controllers/user-notifications-test.js
@@ -18,10 +18,7 @@ module("Unit | Controller | user-notifications", function (hooks) {
await controller.markRead();
- assert.strictEqual(
- model.every(({ read }) => read === true),
- true
- );
+ assert.true(model.every(({ read }) => read === true));
});
test("Mark read does not mark models read when response is not successful", async function (assert) {
@@ -56,6 +53,6 @@ module("Unit | Controller | user-notifications", function (hooks) {
controller.send("resetNew");
- assert.strictEqual(markRead, true);
+ assert.true(markRead);
});
});
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/allow-lister-test.js b/app/assets/javascripts/discourse/tests/unit/lib/allow-lister-test.js
index 40127b195e9..a8052de3c3e 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/allow-lister-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/allow-lister-test.js
@@ -8,16 +8,17 @@ module("Unit | Utility | allowLister", function (hooks) {
test("allowLister", function (assert) {
const allowLister = new AllowLister();
- assert.ok(
+ assert.true(
Object.keys(allowLister.getAllowList().tagList).length > 1,
- "should have some defaults"
+ "has some defaults"
);
allowLister.disable("default");
- assert.ok(
- Object.keys(allowLister.getAllowList().tagList).length === 0,
- "should have no defaults if disabled"
+ assert.strictEqual(
+ Object.keys(allowLister.getAllowList().tagList).length,
+ 0,
+ "has no defaults if disabled"
);
allowLister.allowListFeature("test", [
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js b/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js
index b7e80144e46..3ac979b3fd3 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js
@@ -56,11 +56,11 @@ module("Unit | Utility | category-badge", function (hooks) {
const store = getOwner(this).lookup("service:store");
const category = store.createRecord("category", { name: "hello", id: 123 });
- assert.ok(
- !categoryBadgeHTML(category).includes("topic-count"),
+ assert.notOk(
+ categoryBadgeHTML(category).includes("topic-count"),
"it does not include topic count by default"
);
- assert.ok(
+ assert.true(
categoryBadgeHTML(category, { topicCount: 20 }).indexOf("topic-count") >
20,
"is included when specified"
@@ -137,21 +137,21 @@ module("Unit | Utility | category-badge", function (hooks) {
});
siteSettings.max_category_nesting = 0;
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
- assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
+ assert.false(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
siteSettings.max_category_nesting = 1;
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
- assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
+ assert.false(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
siteSettings.max_category_nesting = 2;
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
- assert.ok(!categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
+ assert.false(categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
siteSettings.max_category_nesting = 3;
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
- assert.ok(categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("baz"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("bar"));
+ assert.true(categoryBadgeHTML(baz, { recursive: true }).includes("foo"));
});
});
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js b/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js
index 81305b4b25f..b35e5a02822 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js
@@ -26,7 +26,7 @@ function testOpenInANewTab(description, clickEventModifier) {
const clickEvent = generateClickEventOn("a");
clickEventModifier(clickEvent);
assert.true(track(clickEvent));
- assert.strictEqual(clickEvent.defaultPrevented, false);
+ assert.false(clickEvent.defaultPrevented);
});
}
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js b/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js
index b54240fb8e0..7122636f726 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js
@@ -32,9 +32,10 @@ module("Unit | Utility | computed", function (hooks) {
"airplane",
"it has the value of the site setting"
);
- assert.ok(
- !t.missingProp,
- "it is falsy when the site setting is not defined"
+ assert.strictEqual(
+ t.missingProp,
+ undefined,
+ "is falsy when the site setting is not defined"
);
});
@@ -47,9 +48,9 @@ module("Unit | Utility | computed", function (hooks) {
biscuits: 10,
});
- assert.ok(t.same, "it is true when the properties are the same");
+ assert.true(t.same, "is true when the properties are the same");
t.set("biscuits", 9);
- assert.ok(!t.same, "it isn't true when one property is different");
+ assert.false(t.same, "isn't true when one property is different");
});
test("propertyNotEqual", function (assert) {
@@ -61,9 +62,9 @@ module("Unit | Utility | computed", function (hooks) {
biscuits: 10,
});
- assert.ok(!t.diff, "it isn't true when the properties are the same");
+ assert.false(t.diff, "isn't true when the properties are the same");
t.set("biscuits", 9);
- assert.ok(t.diff, "it is true when one property is different");
+ assert.true(t.diff, "is true when one property is different");
});
test("fmt", function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js b/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js
index d3f306e61f4..45c78c7a49f 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js
@@ -15,9 +15,9 @@ module("Unit | Utility | get-url", function (hooks) {
test("isAbsoluteURL", function (assert) {
setupURL(null, "https://example.com", "/forum");
- assert.ok(isAbsoluteURL("https://example.com/test/thing"));
- assert.ok(!isAbsoluteURL("http://example.com/test/thing"));
- assert.ok(!isAbsoluteURL("https://discourse.org/test/thing"));
+ assert.true(isAbsoluteURL("https://example.com/test/thing"));
+ assert.false(isAbsoluteURL("http://example.com/test/thing"));
+ assert.false(isAbsoluteURL("https://discourse.org/test/thing"));
});
test("getAbsoluteURL", function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
index 006dfbced34..6b5e480b95c 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
@@ -11,7 +11,7 @@ module("Unit | Utility | icon-library", function (hooks) {
setupTest(hooks);
test("return icon markup", function (assert) {
- assert.ok(iconHTML("bars").includes('use href="#bars"'));
+ assert.true(iconHTML("bars").includes('use href="#bars"'));
const nodeIcon = iconNode("bars");
assert.strictEqual(nodeIcon.tagName, "svg");
@@ -23,10 +23,10 @@ module("Unit | Utility | icon-library", function (hooks) {
test("convert icon names", function (assert) {
const faIcon = convertIconClass("fab fa-facebook");
- assert.ok(iconHTML(faIcon).includes("fab-facebook"), "FA syntax");
+ assert.true(iconHTML(faIcon).includes("fab-facebook"), "FA syntax");
const iconC = convertIconClass(" fab fa-facebook ");
- assert.ok(!iconHTML(iconC).includes(" "), "trims whitespace");
+ assert.false(iconHTML(iconC).includes(" "), "trims whitespace");
});
test("escape icon names, classes, titles and aria-label", function (assert) {
@@ -36,15 +36,15 @@ module("Unit | Utility | icon-library", function (hooks) {
class: "'",
"aria-label": "