Skip to content

A platform for community discussion. Free, open, simple.

DEV: Convert more `notOk` assertions (#29556)

Jarek Radosz9694d2477a0d
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js
index db8e736225b..1340cfacc8d 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-sidebar-section-test.js
@@ -195,26 +195,29 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
"link is appended to the root section"
);
- assert.notOk(
- exists(
+ assert
+ .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_route_or_href\"]"
- ),
- "invalid link that has no route or href is not appended to the root section"
- );
+ )
+ .doesNotExist(
+ "invalid link that has no route or href is not appended to the root section"
+ );
- assert.notOk(
- exists(
+ assert
+ .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_label_or_text\"]"
- ),
- "invalid link that has no label or text is not appended to the root section"
- );
+ )
+ .doesNotExist(
+ "invalid link that has no label or text is not appended to the root section"
+ );
- assert.notOk(
- exists(
+ assert
+ .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_invalid_label\"]"
- ),
- "invalid link with an invalid I18n key is not appended to the root section"
- );
+ )
+ .doesNotExist(
+ "invalid link with an invalid I18n key is not appended to the root section"
+ );
});
test("community section links are added to primary and secondary sections with the plugin API", async function (assert) {
@@ -225,25 +228,24 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
"#sidebar-section-content-community .sidebar-section-link[data-link-name='primary']"
)
);
- assert.notOk(
- exists(
+ assert
+ .dom(
"#sidebar-section-content-community .sidebar-section-link[data-link-name='secondary']"
)
- );
+ .doesNotExist();
await click(".sidebar-more-section-links-details-summary");
- assert.notOk(
- exists(
+ assert
+ .dom(
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='primary']"
)
- );
+ .doesNotExist();
assert.ok(
exists(
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='secondary']"
)
);
- assert.ok(true);
});
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
index 9230f7d4987..89f8fbd6ff9 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js
@@ -267,7 +267,7 @@ acceptance("Admin - User Index", function (needs) {
await click(".dialog-footer .btn-primary");
- assert.notOk(deleteAndBlock, "user does not get blocked");
+ assert.false(deleteAndBlock, "user does not get blocked");
});
test("delete user - delete and block works as expected", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
index ff544f3146b..30c07d4fab7 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js
@@ -29,7 +29,7 @@ acceptance("Category Edit - Security", function (needs) {
await visit("/c/bug/edit/security");
await availableGroups.expand();
- assert.notOk(
+ assert.false(
availableGroups.rowByValue("everyone").exists(),
"everyone is already used and is not in the available groups"
);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
index 9deec7c969b..2541ca26339 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js
@@ -1104,7 +1104,7 @@ acceptance("Composer - Error Extensibility", function (needs) {
await fillIn("#reply-title", "this title triggers an error");
await fillIn(".d-editor-input", "this is the *content* of a post");
await click("#reply-control button.create");
- assert.notOk(exists(".dialog-body"), "it does not pop up an error message");
+ assert.dom(".dialog-body").doesNotExist("does not pop up an error message");
});
test("Create a topic with server side errors not handled by a plugin", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
index 7dc4500884c..55956cde13e 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js
@@ -149,7 +149,7 @@ acceptance("Dashboard: dashboard_hidden_reports", function (needs) {
await visit("/admin");
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
- assert.notOk(exists(".admin-report.is-visible.posts"), "posts report");
+ assert.dom(".admin-report.is-visible.posts").doesNotExist("posts report");
assert
.dom(".admin-report.is-visible.dau-by-mau")
.doesNotExist("dau-by-mau report");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
index c9d357386f3..e8c1fea1836 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
@@ -90,12 +90,11 @@ acceptance(
".sidebar-section[data-section-name='messages'] .sidebar-section-header"
);
- assert.notOk(
- exists(
+ assert
+ .dom(
".sidebar-section[data-section-name='messages'] .sidebar-section-content"
- ),
- "hides the content of the section"
- );
+ )
+ .doesNotExist("hides the content of the section");
});
test("personal messages section links", async function (assert) {
@@ -176,12 +175,13 @@ acceptance(
`personal message ${type} link is marked as active`
);
- assert.notOk(
- exists(
+ assert
+ .dom(
`.sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-${type}'] .sidebar-section-link-prefix`
- ),
- `prefix is not displayed for ${type} personal message section link`
- );
+ )
+ .doesNotExist(
+ `prefix is not displayed for ${type} personal message section link`
+ );
});
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/wrapper-test.js b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/wrapper-test.js
index 230b50ddfa6..c289de94d84 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/form-template-field/wrapper-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/form-template-field/wrapper-test.js
@@ -16,10 +16,9 @@ module(
hbs`<FormTemplateField::Wrapper @content={{this.content}} />`
);
- assert.notOk(
- exists(".form-template-field"),
- "A form template field should not exist"
- );
+ assert
+ .dom(".form-template-field")
+ .doesNotExist("A form template field should not exist");
assert.ok(exists(".alert"), "An alert message should exist");
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
index 2127e356d82..c427d1107be 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js
@@ -40,7 +40,7 @@ module(
await this.subject.expand();
- assert.notOk(this.subject.rowByValue(2).exists());
+ assert.false(this.subject.rowByValue(2).exists());
});
test("with scopedCategoryId", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js
index 8526af9ba9f..9ac6375807d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js
@@ -57,10 +57,9 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
await click(header.el().querySelector(".btn-clear"));
- assert.notOk(
- header.el().querySelector(".btn-clear"),
- "it hides the clear button"
- );
+ assert
+ .dom(".btn-clear", header.el())
+ .doesNotExist("hides the clear button");
assert.strictEqual(header.value(), null);
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js
index 64700081296..a358b0e6c4b 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js
@@ -49,9 +49,9 @@ module(
assert.ok(this.subject.isExpanded());
await this.subject.selectRowByValue(DEFAULT_VALUE);
- assert.notOk(
+ assert.false(
this.subject.isExpanded(),
- "it collapses the dropdown on select"
+ "collapses the dropdown on select"
);
});
@@ -74,10 +74,9 @@ module(
/>
`);
- assert.notOk(
- this.subject.header().el().querySelector(".selected-name"),
- "it hides the text of the selected item"
- );
+ assert
+ .dom(".selected-name", this.subject.header().el())
+ .doesNotExist("hides the text of the selected item");
assert.strictEqual(
this.subject.header().el().getAttribute("title"),
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/future-date-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/future-date-input-test.js
index d02b0ab7e4f..e9111216eed 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/future-date-input-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/future-date-input-test.js
@@ -108,7 +108,7 @@ module(
const options = getOptions();
const customDateAndTime = I18n.t("time_shortcut.custom");
- assert.notOk(options.includes(customDateAndTime));
+ assert.false(options.includes(customDateAndTime));
});
test("shows the now option if enabled", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js
index 19a6e470007..784b3e64c77 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js
@@ -74,7 +74,7 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
await this.subject.expand();
await this.subject.selectRowByValue(1);
- assert.notOk(this.subject.isExpanded(), "it closes the dropdown");
+ assert.false(this.subject.isExpanded(), "closes the dropdown");
await this.subject.expand();
await this.subject.deselectItemByValue(1);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js
index e5ec56fea69..b219f113d2f 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js
@@ -97,7 +97,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await tab();
- assert.notOk(
+ assert.false(
this.subject.isExpanded(),
"when there are no more rows, Tab collapses the dropdown"
);
@@ -108,7 +108,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await tab({ backwards: true });
- assert.notOk(this.subject.isExpanded(), "Shift+Tab collapses the dropdown");
+ assert.false(this.subject.isExpanded(), "Shift+Tab collapses the dropdown");
});
test("value", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js
index b65284e5db2..2e59f1e6a80 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js
@@ -2,12 +2,7 @@ import { fillIn, 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 {
- count,
- exists,
- query,
- queryAll,
-} from "discourse/tests/helpers/qunit-helpers";
+import { count, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "discourse-i18n";
import Theme, { COMPONENTS, THEMES } from "admin/models/theme";
@@ -137,7 +132,7 @@ module("Integration | Component | themes-list", function (hooks) {
"themes tab is not active"
);
- assert.notOk(exists(".inactive-indicator"), "there is no separator");
+ assert.dom(".inactive-indicator").doesNotExist("there is no separator");
assert.strictEqual(
count(".themes-list-container__item .info"),
5,
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
index e815428cf66..00c9e0a2e5a 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-info-test.js
@@ -36,9 +36,9 @@ module("Integration | Component | user-info", function (hooks) {
assert.ok(exists(`.name-line a[href="/u/${this.currentUser.username}"]`));
this.set("includeLink", false);
- assert.notOk(
- exists(`.name-line a[href="/u/${this.currentUser.username}"]`)
- );
+ assert
+ .dom(`.name-line a[href="/u/${this.currentUser.username}"]`)
+ .doesNotExist();
});
test("includeAvatar", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-menu/bookmarks-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-menu/bookmarks-list-test.js
index d73d9d62b44..23953dcc0e7 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/user-menu/bookmarks-list-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/user-menu/bookmarks-list-test.js
@@ -56,10 +56,11 @@ module(
this.currentUser.set("grouped_unread_notifications", {});
await settled();
- assert.notOk(
- exists(".panel-body-bottom .notifications-dismiss"),
- "dismiss button is not shown if the user no unread bookmark_reminder notifications"
- );
+ assert
+ .dom(".panel-body-bottom .notifications-dismiss")
+ .doesNotExist(
+ "dismiss button is not shown if the user no unread bookmark_reminder notifications"
+ );
});
test("empty state (aka blank page syndrome)", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
index 1d120e2f902..19533e6f276 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.js
@@ -108,10 +108,11 @@ module(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
);
- assert.notOk(
- exists(".abcde"),
- "custom CSS class is not added when condition is not met"
- );
+ assert
+ .dom(".abcde")
+ .doesNotExist(
+ "custom CSS class is not added when condition is not met"
+ );
this.set("args", { id: 123, canRecover: true });
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js
index dcaa7fb998f..bedc4eeae51 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.js
@@ -452,7 +452,7 @@ module("Integration | Component | Widget | base", function (hooks) {
const parent = elementOneBefore.parentNode;
const observer = new MutationObserver(function (mutations) {
- assert.notOk(
+ assert.false(
mutations.some((m) =>
Array.from(m.addedNodes).includes(elementOneBefore)
)
diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/admin-user-badges-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/admin-user-badges-test.js
index c53fd52c0b5..9adf56e9bab 100644
--- a/app/assets/javascripts/discourse/tests/unit/controllers/admin-user-badges-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/controllers/admin-user-badges-test.js
@@ -55,7 +55,7 @@ module("Unit | Controller | admin-user-badges", function (hooks) {
const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name];
const badgeNames = controller.availableBadges.map((badge) => badge.name);
- assert.notOk(
+ assert.false(
badgeNames.includes(badgeDisabled),
"excludes disabled badges"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/dag-test.js b/app/assets/javascripts/discourse/tests/unit/lib/dag-test.js
index 906f5516589..2afdf16c1d8 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/dag-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/dag-test.js
@@ -27,7 +27,7 @@ module("Unit | Lib | DAG", function (hooks) {
dag.delete("key2");
assert.ok(dag.has("key1"));
- assert.notOk(dag.has("key2"));
+ assert.false(dag.has("key2"));
assert.ok(dag.has("key3"));
});
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/lightbox/helpers/preload-item-images-test.js b/app/assets/javascripts/discourse/tests/unit/lib/lightbox/helpers/preload-item-images-test.js
index e2a4173f4e7..81f3ac5ff6c 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/lightbox/helpers/preload-item-images-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/lightbox/helpers/preload-item-images-test.js
@@ -68,7 +68,7 @@ module(
const result = await preloadItemImages(lightboxItem);
- assert.notOk(
+ assert.false(
result.canZoom,
"canZoom should be false if fullsizeImage width or height is smaller than window inner width or height"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js b/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
index 5bebc07817d..a420061d694 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
@@ -237,12 +237,12 @@ module("Unit | Utility | sanitizer", function (hooks) {
)
.match(/muted/)
);
- assert.notOk(
- engine
- .sanitize(
+ assert.false(
+ /muted/.test(
+ engine.sanitize(
`<p>Hey</p><video><source src="http://example.com/music.mp4" type="audio/mpeg"></video>`
)
- .match(/muted/)
+ )
);
});
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/time-shortcut-test.js b/app/assets/javascripts/discourse/tests/unit/lib/time-shortcut-test.js
index 7cf17b28ef8..5efc3a54912 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/time-shortcut-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/time-shortcut-test.js
@@ -28,7 +28,7 @@ module(
this.clock.restore();
this.clock = fakeTime("2100-04-19 18:00:00", timezone, true); // evening
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
- assert.notOk(result.includes("doesn't show later_today in the evening"));
+ assert.false(result.includes("doesn't show later_today in the evening"));
});
test("hides 'Later This Week' starting from Thursday", function (assert) {
@@ -45,7 +45,7 @@ module(
this.clock.restore();
this.clock = fakeTime("2100-04-22 18:00:00", timezone, true); // Thursday
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("later_this_week"),
"doesn't show later_this_week on Thursdays"
);
@@ -53,7 +53,7 @@ module(
this.clock.restore();
this.clock = fakeTime("2100-04-23 18:00:00", timezone, true); // Friday
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("later_this_week"),
"doesn't show later_this_week on Fridays"
);
@@ -82,7 +82,7 @@ module(
timezone,
siteSettings
).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("this_weekend"),
"doesn't show this_weekend on Fridays"
);
@@ -94,7 +94,7 @@ module(
timezone,
siteSettings
).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("this_weekend"),
"doesn't show this_weekend on Saturdays"
);
@@ -106,7 +106,7 @@ module(
timezone,
siteSettings
).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("this_weekend"),
"doesn't show this_weekend on Sundays"
);
@@ -123,7 +123,7 @@ module(
timezone,
siteSettings
).mapBy("id");
- assert.notOk(
+ assert.false(
result.includes("this_weekend"),
"shows this_weekend on Thursdays"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js b/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js
index 3237f495d37..df1aabfba34 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js
@@ -23,15 +23,15 @@ module("Unit | Utility | uploads", function (hooks) {
});
test("validateUploadedFiles", function (assert) {
- assert.notOk(
+ assert.false(
validateUploadedFiles(null, { siteSettings: this.siteSettings }),
"no files are invalid"
);
- assert.notOk(
+ assert.false(
validateUploadedFiles(undefined, { siteSettings: this.siteSettings }),
"undefined files are invalid"
);
- assert.notOk(
+ assert.false(
validateUploadedFiles([], { siteSettings: this.siteSettings }),
"empty array of files is invalid"
);
@@ -40,7 +40,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("uploading one file", function (assert) {
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([1, 2], { siteSettings: this.siteSettings })
);
assert.ok(dialog.alert.calledWith(I18n.t("post.errors.too_many_uploads")));
@@ -50,7 +50,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.newuser_max_embedded_media = 0;
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([{ name: "image.png" }], {
user: this.store.createRecord("user"),
siteSettings: this.siteSettings,
@@ -94,7 +94,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.newuser_max_attachments = 0;
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([{ name: "roman.txt" }], {
user: this.store.createRecord("user"),
siteSettings: this.siteSettings,
@@ -109,7 +109,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("ensures an authorized upload", function (assert) {
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([{ name: "unauthorized.html" }], {
siteSettings: this.siteSettings,
})
@@ -130,7 +130,7 @@ module("Unit | Utility | uploads", function (hooks) {
const files = [{ name: "backup.tar.gz" }];
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles(files, {
skipValidation: false,
siteSettings: this.siteSettings,
@@ -149,7 +149,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.authorized_extensions_for_staff = "";
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([{ name: "test.jpg" }], {
user: this.store.createRecord("user"),
siteSettings: this.siteSettings,
@@ -165,7 +165,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.authorized_extensions_for_staff = "";
sinon.stub(dialog, "alert");
- assert.notOk(
+ assert.false(
validateUploadedFiles([{ name: "test.jpg" }], {
user: this.store.createRecord("user", { staff: true }),
siteSettings: this.siteSettings,
@@ -182,7 +182,7 @@ module("Unit | Utility | uploads", function (hooks) {
sinon.stub(dialog, "alert");
let user = this.store.createRecord("user", { moderator: true });
- assert.notOk(
+ assert.false(
validateUploadedFiles(files, { user, siteSettings: this.siteSettings })
);
assert.ok(
@@ -231,7 +231,7 @@ module("Unit | Utility | uploads", function (hooks) {
})
);
- assert.notOk(dialog.alert.calledOnce);
+ assert.false(dialog.alert.calledOnce);
});
test("isImage", function (assert) {
@@ -245,9 +245,9 @@ module("Unit | Utility | uploads", function (hooks) {
);
}
);
- assert.notOk(isImage("file.txt"));
- assert.notOk(isImage("http://foo.bar/path/to/file.txt"));
- assert.notOk(isImage(""));
+ assert.false(isImage("file.txt"));
+ assert.false(isImage("http://foo.bar/path/to/file.txt"));
+ assert.false(isImage(""));
});
test("allowsImages", function (assert) {
@@ -275,7 +275,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("allowsAttachments", function (assert) {
this.siteSettings.authorized_extensions = "jpg|jpeg|gif";
- assert.notOk(
+ assert.false(
allowsAttachments(false, this.siteSettings),
"no attachments allowed by default"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/models/tag-test.js b/app/assets/javascripts/discourse/tests/unit/models/tag-test.js
index 278ad569dcb..ae3941afeab 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/tag-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/tag-test.js
@@ -22,7 +22,7 @@ module("Unit | Model | tag", function (hooks) {
test("pmOnly", function (assert) {
const tag = this.store.createRecord("tag", { pm_only: false });
- assert.notOk(tag.pmOnly);
+ assert.false(tag.pmOnly);
tag.set("pm_only", true);
diff --git a/app/assets/javascripts/discourse/tests/unit/models/topic-test.js b/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
index b27ae1e08f8..46a18487b5c 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/topic-test.js
@@ -25,7 +25,7 @@ module("Unit | Model | topic", function (hooks) {
last_read_post_number: 1,
});
- assert.notOk(topic.visited, "not visited unless we've read all the posts");
+ assert.false(topic.visited, "not visited unless we've read all the posts");
topic.set("last_read_post_number", 2);
assert.ok(topic.visited, "is visited once we've read all the posts");
diff --git a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
index 539c1c63e20..6563f102276 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/topic-tracking-state-test.js
@@ -368,7 +368,7 @@ module("Unit | Model | topic-tracking-state", function (hooks) {
trackingState.sync(list, "unread");
- assert.notOk(
+ assert.false(
trackingState.states.has("t111"),
"expect state for topic 111 to be deleted"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/models/user-badge-test.js b/app/assets/javascripts/discourse/tests/unit/models/user-badge-test.js
index 686dbec87ed..dbfc812e1a9 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/user-badge-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/user-badge-test.js
@@ -67,7 +67,7 @@ module("Unit | Model | user-badge", function (hooks) {
test("favorite", async function (assert) {
const store = getOwner(this).lookup("service:store");
const userBadge = store.createRecord("user-badge", { id: 1 });
- assert.notOk(userBadge.is_favorite);
+ assert.strictEqual(userBadge.is_favorite, undefined);
await userBadge.favorite();
assert.ok(userBadge.is_favorite);
diff --git a/app/assets/javascripts/discourse/tests/unit/models/user-test.js b/app/assets/javascripts/discourse/tests/unit/models/user-test.js
index 819ca7f88ab..e8892adaaca 100644
--- a/app/assets/javascripts/discourse/tests/unit/models/user-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/models/user-test.js
@@ -185,11 +185,11 @@ module("Unit | Model | user", function (hooks) {
_clearStatusTimerId: 100,
});
- assert.notOk(
+ assert.false(
user.hasOwnProperty("_subscribersCount"),
"_subscribersCount wasn't set"
);
- assert.notOk(
+ assert.false(
user.hasOwnProperty("_clearStatusTimerId"),
"_clearStatusTimerId wasn't set"
);
diff --git a/app/assets/javascripts/discourse/tests/unit/services/header-test.js b/app/assets/javascripts/discourse/tests/unit/services/header-test.js
index 6de6da6bbcd..e0b7b69aa40 100644
--- a/app/assets/javascripts/discourse/tests/unit/services/header-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/services/header-test.js
@@ -17,6 +17,6 @@ module("Unit | Service | header", function (hooks) {
test("it does not register invalid buttons for hiders", function (assert) {
this.header.registerHider(this, ["search", "blahblah"]);
- assert.notOk(this.header.headerButtonsHidden.includes("blah"));
+ assert.false(this.header.headerButtonsHidden.includes("blah"));
});
});
diff --git a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js
index cb9888144e0..807067c4bd5 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js
@@ -1,10 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { skip } from "qunit";
-import {
- acceptance,
- exists,
- visible,
-} from "discourse/tests/helpers/qunit-helpers";
+import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers";
acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
needs.user({
@@ -118,19 +114,19 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
assert.ok(visible(videoContainer));
assert.ok(visible(collapseImage), "the open arrow is shown");
- assert.notOk(exists(expandImage), "the close arrow is hidden");
+ assert.dom(expandImage).doesNotExist("the close arrow is hidden");
await click(collapseImage);
- assert.notOk(visible(videoContainer));
+ assert.dom(videoContainer).isNotVisible();
assert.ok(visible(expandImage), "the close arrow is shown");
- assert.notOk(exists(collapseImage), "the open arrow is hidden");
+ assert.dom(collapseImage).doesNotExist("the open arrow is hidden");
await click(expandImage);
assert.ok(visible(videoContainer));
assert.ok(visible(collapseImage), "the open arrow is shown again");
- assert.notOk(exists(expandImage), "the close arrow is hidden again");
+ assert.dom(expandImage).doesNotExist("the close arrow is hidden again");
});
skip("lightbox shows up before and after expand and collapse", async function (assert) {
diff --git a/plugins/chat/test/javascripts/unit/services/chat-emoji-picker-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-emoji-picker-manager-test.js
index 4979945f780..5e75b4a64bc 100644
--- a/plugins/chat/test/javascripts/unit/services/chat-emoji-picker-manager-test.js
+++ b/plugins/chat/test/javascripts/unit/services/chat-emoji-picker-manager-test.js
@@ -102,8 +102,8 @@ module(
await settled();
- assert.notOk(this.manager.picker);
- assert.notOk(this.manager.closing);
+ assert.strictEqual(this.manager.picker, null);
+ assert.false(this.manager.closing);
assert.deepEqual(
this.manager.visibleSections,
["favorites", "smileys_&_emotion"],
diff --git a/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js b/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js
index 72ebb20d6b4..9cad263ae26 100644
--- a/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js
+++ b/plugins/chat/test/javascripts/unit/services/chat-guardian-test.js
@@ -25,29 +25,29 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = false;
- assert.notOk(this.chatGuardian.canEditChatChannel());
+ assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", true);
this.siteSettings.chat_enabled = false;
- assert.notOk(this.chatGuardian.canEditChatChannel());
+ assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", false);
set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = true;
- assert.notOk(this.chatGuardian.canEditChatChannel());
+ assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", false);
set(this.currentUser, "admin", true);
this.siteSettings.chat_enabled = true;
- assert.notOk(this.chatGuardian.canEditChatChannel());
+ assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = true;
- assert.notOk(this.chatGuardian.canEditChatChannel());
+ assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", true);
@@ -58,11 +58,11 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
test("#canUseChat", async function (assert) {
set(this.currentUser, "has_chat_enabled", false);
this.siteSettings.chat_enabled = true;
- assert.notOk(this.chatGuardian.canUseChat());
+ assert.false(this.chatGuardian.canUseChat());
set(this.currentUser, "has_chat_enabled", true);
this.siteSettings.chat_enabled = false;
- assert.notOk(this.chatGuardian.canUseChat());
+ assert.false(this.chatGuardian.canUseChat());
set(this.currentUser, "has_chat_enabled", true);
this.siteSettings.chat_enabled = true;
@@ -80,16 +80,16 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false);
- assert.notOk(this.chatGuardian.canArchiveChannel(channel));
+ assert.false(this.chatGuardian.canArchiveChannel(channel));
set(this.currentUser, "admin", true);
set(this.currentUser, "moderator", true);
channel.status = "read_only";
- assert.notOk(this.chatGuardian.canArchiveChannel(channel));
+ assert.false(this.chatGuardian.canArchiveChannel(channel));
channel.status = "open";
channel.status = "archived";
- assert.notOk(this.chatGuardian.canArchiveChannel(channel));
+ assert.false(this.chatGuardian.canArchiveChannel(channel));
channel.status = "open";
});
});
diff --git a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
index abd87f51022..1225951b2af 100644
--- a/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
+++ b/plugins/chat/test/javascripts/unit/services/chat-state-manager-test.js
@@ -22,7 +22,7 @@ module(
});
test("isFullPagePreferred", function (assert) {
- assert.notOk(this.subject.isFullPagePreferred);
+ assert.false(this.subject.isFullPagePreferred);
this.subject.prefersFullPage();
@@ -30,7 +30,7 @@ module(
this.subject.prefersDrawer();
- assert.notOk(this.subject.isFullPagePreferred);
+ assert.false(this.subject.isFullPagePreferred);
this.subject.prefersDrawer();
Site.currentProp("mobileView", true);
@@ -43,7 +43,7 @@ module(
this.subject.prefersFullPage();
- assert.notOk(this.subject.isDrawerPreferred);
+ assert.false(this.subject.isDrawerPreferred);
this.subject.prefersDrawer();
@@ -73,7 +73,7 @@ module(
test("isFullPageActive", function (assert) {
sinon.stub(this.subject.router, "currentRouteName").value("foo");
- assert.notOk(this.subject.isFullPageActive);
+ assert.false(this.subject.isFullPageActive);
sinon.stub(this.subject.router, "currentRouteName").value("chat");
assert.ok(this.subject.isFullPageActive);
diff --git a/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js b/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js
index 55eb9d298de..caca49db3f3 100644
--- a/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js
+++ b/plugins/chat/test/javascripts/unit/utility/plugin-api-test.js
@@ -68,7 +68,7 @@ module("Chat | Unit | Utility | plugin-api", function (hooks) {
updatedSecondaryActions.length < secondaryActions.length,
"the updated secondary actions must contain less items than the original"
);
- assert.notOk(
+ assert.false(
updatedSecondaryActions
.map((v) => v.id)
.includes(secondaryActions[0]),
diff --git a/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js b/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js
index e1a7fd3006d..79d2602bb8a 100644
--- a/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js
+++ b/plugins/discourse-local-dates/test/javascripts/lib/date-with-zone-helper-test.js
@@ -108,9 +108,9 @@ module("lib:date-with-zone-helper", function () {
timezone: PARIS,
});
- assert.notOk(date.isDST());
+ assert.false(date.isDST());
futureLocalDate = date.add(8, "months");
- assert.notOk(futureLocalDate.isDST());
+ assert.false(futureLocalDate.isDST());
assert.strictEqual(
futureLocalDate.format(),
"2020-11-19T15:36:00.000+01:00",
@@ -140,7 +140,7 @@ module("lib:date-with-zone-helper", function () {
minute: 36,
timezone: PARIS,
});
- assert.notOk(date.isDST());
+ assert.false(date.isDST());
futureLocalDate = date.add(1, "week");
assert.ok(futureLocalDate.isDST());
assert.strictEqual(
@@ -159,7 +159,7 @@ module("lib:date-with-zone-helper", function () {
assert.ok(date.isDST());
futureLocalDate = date.add(8, "months");
- assert.notOk(futureLocalDate.isDST());
+ assert.false(futureLocalDate.isDST());
assert.strictEqual(
futureLocalDate.format(),
"2020-12-01T15:36:00.000+01:00",