From 45572f943141f167655acdbcc9f862fc8a7c5e82 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 9 Feb 2022 18:49:05 +0100 Subject: [PATCH] DEV: Deprecate `assert.not()` (#15595) Use QUnit's standard `assert.notOk()` instead. --- .../tests/acceptance/bookmarks-test.js | 6 +-- .../create-account-external-test.js | 5 +- .../tests/acceptance/invite-accept-test.js | 4 +- .../invite-show-user-fields-test.js | 2 +- .../tests/acceptance/search-full-test.js | 8 +-- .../tests/acceptance/sign-in-test.js | 12 ++--- .../tests/acceptance/topic-move-posts-test.js | 4 +- .../tests/acceptance/user-bookmarks-test.js | 4 +- .../tests/acceptance/user-card-test.js | 2 +- .../discourse/tests/helpers/qunit-helpers.js | 5 ++ .../controllers/admin-user-badges-test.js | 5 +- .../tests/unit/controllers/topic-test.js | 50 +++++++++++-------- .../tests/unit/lib/timeframes-builder-test.js | 8 +-- .../discourse/tests/unit/lib/uploads-test.js | 28 +++++------ .../discourse/tests/unit/lib/url-test.js | 10 ++-- .../mixins/grant-badge-controller-test.js | 6 +-- .../discourse/tests/unit/models/topic-test.js | 2 +- .../discourse/tests/unit/models/user-test.js | 2 +- 18 files changed, 90 insertions(+), 73 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js index aae3996900e..a1704a76266 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js @@ -183,7 +183,7 @@ acceptance("Bookmarking", function (needs) { exists(".topic-post:first-child button.bookmark.bookmarked"), "it shows the bookmarked icon on the post" ); - assert.not( + assert.notOk( exists( ".topic-post:first-child button.bookmark.bookmarked > .d-icon-discourse-bookmark-clock" ), @@ -215,7 +215,7 @@ acceptance("Bookmarking", function (needs) { await click(".bootbox.modal .btn-primary"); - assert.not( + assert.notOk( exists(".topic-post:first-child button.bookmark.bookmarked"), "it no longer shows the bookmarked icon on the post after bookmark is deleted" ); @@ -225,7 +225,7 @@ acceptance("Bookmarking", function (needs) { await visit("/t/internationalization-localization/280"); await openBookmarkModal(); await click(".d-modal-cancel"); - assert.not( + assert.notOk( exists(".topic-post:first-child button.bookmark.bookmarked"), "it does not show the bookmarked icon on the post because it is not saved" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-account-external-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-account-external-test.js index e6ec013d541..2c5e0677efe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/create-account-external-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/create-account-external-test.js @@ -52,7 +52,10 @@ acceptance("Create Account - external auth", function (needs) { "it shows the registration modal" ); - assert.not(exists("#new-account-username"), "it does not show the fields"); + assert.notOk( + exists("#new-account-username"), + "it does not show the fields" + ); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js index cbdfbede6e4..0247a8ea0bb 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js @@ -119,7 +119,7 @@ acceptance("Invite accept", function (needs) { ); await fillIn("#new-account-email", "john.doe@example.com"); - assert.not( + assert.notOk( exists(".invites-show .btn-primary:disabled"), "submit is enabled" ); @@ -151,7 +151,7 @@ acceptance("Invite accept", function (needs) { assert.ok(exists(".username-input .good"), "username is valid"); assert.ok(exists(".password-input .good"), "password is valid"); assert.ok(exists(".email-input .good"), "email is valid"); - assert.not( + assert.notOk( exists(".invites-show .btn-primary:disabled"), "submit is enabled" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/invite-show-user-fields-test.js b/app/assets/javascripts/discourse/tests/acceptance/invite-show-user-fields-test.js index 814e7277563..5dde2646a7a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/invite-show-user-fields-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/invite-show-user-fields-test.js @@ -67,7 +67,7 @@ acceptance("Accept Invite - User Fields", function (needs) { ); await click(".user-field input[type=checkbox]"); - assert.not( + assert.notOk( exists(".invites-show .btn-primary:disabled"), "submit is enabled because field is checked" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js index 97bf8312710..8efa99a8e50 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js @@ -214,7 +214,7 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "none in:titleasd"); - assert.not( + assert.notOk( exists(".search-advanced-options .in-title:checked"), "does not populate title only checkbox" ); @@ -254,7 +254,7 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "none in:personal-direct"); - assert.not( + assert.notOk( exists(".search-advanced-options .in-private:checked"), "does not populate messages checkbox" ); @@ -278,7 +278,7 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "none in:seenasdan"); - assert.not( + assert.notOk( exists(".search-advanced-options .in-seen:checked"), "does not populate seen checkbox" ); @@ -446,7 +446,7 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "in:likesasdas"); - assert.not( + assert.notOk( exists(".search-advanced-options .in-likes:checked"), "does not populate the likes checkbox" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js index 91dcfebe14f..42fd908caa6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js @@ -18,7 +18,7 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "incorrect"); await click(".modal-footer .btn-primary"); assert.ok(exists("#modal-alert:visible"), "it displays the login error"); - assert.not( + assert.notOk( exists(".modal-footer .btn-primary:disabled"), "enables the login button" ); @@ -91,7 +91,7 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "need-second-factor"); await click(".modal-footer .btn-primary"); - assert.not( + assert.notOk( exists("#credentials:visible"), "it hides the username and password prompt" ); @@ -99,7 +99,7 @@ acceptance("Signing In", function () { exists("#second-factor:visible"), "it displays the second factor prompt" ); - assert.not( + assert.notOk( exists(".modal-footer .btn-primary:disabled"), "enables the login button" ); @@ -123,11 +123,11 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "need-security-key"); await click(".modal-footer .btn-primary"); - assert.not( + assert.notOk( exists("#credentials:visible"), "it hides the username and password prompt" ); - assert.not( + assert.notOk( exists("#login-second-factor:visible"), "it does not display the second factor prompt" ); @@ -135,7 +135,7 @@ acceptance("Signing In", function () { exists("#security-key:visible"), "it shows the security key prompt" ); - assert.not(exists("#login-button:visible"), "hides the login button"); + assert.notOk(exists("#login-button:visible"), "hides the login button"); }); test("create account", async function (assert) { diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js index 04a1e68ad53..87b8bbc592a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js @@ -63,7 +63,7 @@ acceptance("Topic move posts", function (needs) { "it opens move to modal" ); - assert.not( + assert.notOk( queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.split_topic.radio_label")), @@ -77,7 +77,7 @@ acceptance("Topic move posts", function (needs) { "it shows an option to move to existing topic" ); - assert.not( + assert.notOk( queryAll(".choose-topic-modal .radios") .html() .includes(I18n.t("topic.move_to_new_message.radio_label")), diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js index a0fd7072d3c..faa7418de2a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-bookmarks-test.js @@ -16,7 +16,7 @@ acceptance("User's bookmarks", function (needs) { await dropdown.expand(); await dropdown.selectRowByValue("remove"); - assert.not(exists(".bootbox.modal"), "it should not show the modal"); + assert.notOk(exists(".bootbox.modal"), "it should not show the modal"); }); test("it renders search controls if there are bookmarks", async function (assert) { @@ -46,7 +46,7 @@ acceptance("User's bookmarks - reminder", function (needs) { assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation"); await click(".bootbox.modal a.btn-primary"); - assert.not(exists(".bootbox.modal")); + assert.notOk(exists(".bootbox.modal")); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-card-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-card-test.js index 4b4a0c1aa3d..95b7eb5b20f 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-card-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-card-test.js @@ -20,7 +20,7 @@ acceptance("User Card - Show Local Time", function (needs) { await visit("/t/internationalization-localization/280"); await click('a[data-user-card="charlie"]'); - assert.not( + assert.notOk( exists(".user-card .local-time"), "it does not show the local time if the user card returns a null/undefined timezone for another user" ); diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js index 3a4bd5f5d0d..1440a393f94 100644 --- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js +++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js @@ -403,6 +403,11 @@ export function fixture(selector) { } QUnit.assert.not = function (actual, message) { + deprecated("assert.not() is deprecated. Use assert.notOk() instead.", { + since: "2.9.0.beta1", + dropFrom: "2.10.0.beta1", + }); + this.pushResult({ result: !actual, actual, 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 529cc342520..439079f0f50 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 @@ -51,7 +51,10 @@ discourseModule("Unit | Controller | admin-user-badges", function () { return badge.name; }); - assert.not(badgeNames.includes(badgeDisabled), "excludes disabled badges"); + assert.notOk( + badgeNames.includes(badgeDisabled), + "excludes disabled badges" + ); assert.deepEqual(badgeNames, sortedNames, "sorts badges by name"); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js index bd8badbf584..5f770e2d5e7 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js @@ -33,12 +33,15 @@ discourseModule("Unit | Controller | topic", function (hooks) { test("editTopic", function (assert) { const model = Topic.create(); const controller = this.getController("topic", { model }); - assert.not(controller.get("editingTopic"), "we are not editing by default"); + assert.notOk( + controller.get("editingTopic"), + "we are not editing by default" + ); controller.set("model.details.can_edit", false); controller.send("editTopic"); - assert.not( + assert.notOk( controller.get("editingTopic"), "calling editTopic doesn't enable editing unless the user can edit" ); @@ -58,7 +61,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.send("cancelEditingTopic"); - assert.not( + assert.notOk( controller.get("editingTopic"), "cancelling edit mode reverts the property value" ); @@ -84,7 +87,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { model.set("views", 10000); controller.send("deleteTopic"); - assert.not(destroyed, "don't destroy popular topic"); + assert.notOk(destroyed, "don't destroy popular topic"); assert.ok(modalDisplayed, "display confirmation modal for popular topic"); model.set("views", 3); @@ -96,7 +99,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { const model = Topic.create(); const controller = this.getController("topic", { model }); - assert.not( + assert.notOk( controller.get("multiSelect"), "multi selection mode is disabled by default" ); @@ -123,7 +126,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.send("toggleMultiSelect"); await settled(); - assert.not( + assert.notOk( controller.get("multiSelect"), "calling 'toggleMultiSelect' twice disables multi selection mode" ); @@ -145,7 +148,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { 2, "selectedPosts only contains already loaded posts" ); - assert.not( + assert.notOk( controller.get("selectedPosts").some((p) => p === undefined), "selectedPosts only contains valid post objects" ); @@ -157,7 +160,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.set("selectedPostIds", [1, 2]); - assert.not( + assert.notOk( controller.get("selectedAllPosts"), "not all posts are selected" ); @@ -240,11 +243,14 @@ discourseModule("Unit | Controller | topic", function (hooks) { const model = Topic.create({ posts_count: 3 }); const controller = this.getController("topic", { model, site }); - assert.not(controller.get("showSelectedPostsAtBottom"), "false on desktop"); + assert.notOk( + controller.get("showSelectedPostsAtBottom"), + "false on desktop" + ); site.set("mobileView", true); - assert.not( + assert.notOk( controller.get("showSelectedPostsAtBottom"), "requires at least 3 posts on mobile" ); @@ -277,14 +283,14 @@ discourseModule("Unit | Controller | topic", function (hooks) { }); const selectedPostIds = controller.get("selectedPostIds"); - assert.not( + assert.notOk( controller.get("canDeleteSelected"), "false when no posts are selected" ); selectedPostIds.pushObject(1); - assert.not( + assert.notOk( controller.get("canDeleteSelected"), "false when can't delete one of the selected posts" ); @@ -298,7 +304,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.pushObject(1); - assert.not( + assert.notOk( controller.get("canDeleteSelected"), "false when all posts are selected and user is staff" ); @@ -324,14 +330,14 @@ discourseModule("Unit | Controller | topic", function (hooks) { const controller = this.getController("topic", { model }); const selectedPostIds = controller.get("selectedPostIds"); - assert.not( + assert.notOk( controller.get("canMergeTopic"), "can't merge topic when no posts are selected" ); selectedPostIds.pushObject(1); - assert.not( + assert.notOk( controller.get("canMergeTopic"), "can't merge topic when can't move posts" ); @@ -377,14 +383,14 @@ discourseModule("Unit | Controller | topic", function (hooks) { }); const selectedPostIds = controller.get("selectedPostIds"); - assert.not( + assert.notOk( controller.get("canChangeOwner"), "false when no posts are selected" ); selectedPostIds.pushObject(1); - assert.not(controller.get("canChangeOwner"), "false when not admin"); + assert.notOk(controller.get("canChangeOwner"), "false when not admin"); currentUser.set("admin", true); @@ -395,7 +401,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.pushObject(2); - assert.not( + assert.notOk( controller.get("canChangeOwner"), "false when admin but more than 1 user" ); @@ -416,28 +422,28 @@ discourseModule("Unit | Controller | topic", function (hooks) { }); const selectedPostIds = controller.get("selectedPostIds"); - assert.not( + assert.notOk( controller.get("canMergePosts"), "false when no posts are selected" ); selectedPostIds.pushObject(1); - assert.not( + assert.notOk( controller.get("canMergePosts"), "false when only one post is selected" ); selectedPostIds.pushObject(2); - assert.not( + assert.notOk( controller.get("canMergePosts"), "false when selected posts are from different users" ); selectedPostIds.replace(1, 1, [3]); - assert.not( + assert.notOk( controller.get("canMergePosts"), "false when selected posts can't be deleted" ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/timeframes-builder-test.js b/app/assets/javascripts/discourse/tests/unit/lib/timeframes-builder-test.js index 06208789681..09dcecae46a 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/timeframes-builder-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/timeframes-builder-test.js @@ -108,7 +108,7 @@ module("Unit | Lib | timeframes-builder", function (hooks) { this.clock = fakeTime("2100-04-19 18:00:00", timezone, true); // Monday evening const timeframes = buildTimeframes(buildOptions(moment())).mapBy("id"); - assert.not(timeframes.includes("later_today")); + assert.notOk(timeframes.includes("later_today")); assert.ok(timeframes.includes("later_this_week")); }); @@ -117,7 +117,7 @@ module("Unit | Lib | timeframes-builder", function (hooks) { this.clock = fakeTime("2100-04-22 18:00:00", timezone, true); // Tuesday evening const timeframes = buildTimeframes(buildOptions(moment())).mapBy("id"); - assert.not(timeframes.includes("later_this_week")); + assert.notOk(timeframes.includes("later_this_week")); }); test("doesn't output 'Later This Week' on Sundays", function (assert) { @@ -138,7 +138,7 @@ module("Unit | Lib | timeframes-builder", function (hooks) { this.clock = fakeTime("2100-04-25 18:00:00", timezone, true); // Sunday evening const timeframes = buildTimeframes(buildOptions(moment())).mapBy("id"); - assert.not(timeframes.includes("later_this_week")); + assert.notOk(timeframes.includes("later_this_week")); }); test("doesn't output 'Next Month' on the last day of the month", function (assert) { @@ -146,6 +146,6 @@ module("Unit | Lib | timeframes-builder", function (hooks) { this.clock = fakeTime("2100-04-30 18:00:00", timezone, true); // The last day of April const timeframes = buildTimeframes(buildOptions(moment())).mapBy("id"); - assert.not(timeframes.includes("next_month")); + assert.notOk(timeframes.includes("next_month")); }); }); 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 68d3f4de72c..e2ca35c97a0 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/uploads-test.js @@ -17,15 +17,15 @@ import { test } from "qunit"; discourseModule("Unit | Utility | uploads", function () { test("validateUploadedFiles", function (assert) { - assert.not( + assert.notOk( validateUploadedFiles(null, { siteSettings: this.siteSettings }), "no files are invalid" ); - assert.not( + assert.notOk( validateUploadedFiles(undefined, { siteSettings: this.siteSettings }), "undefined files are invalid" ); - assert.not( + assert.notOk( validateUploadedFiles([], { siteSettings: this.siteSettings }), "empty array of files is invalid" ); @@ -34,7 +34,7 @@ discourseModule("Unit | Utility | uploads", function () { test("uploading one file", function (assert) { sinon.stub(bootbox, "alert"); - assert.not( + assert.notOk( validateUploadedFiles([1, 2], { siteSettings: this.siteSettings }) ); assert.ok(bootbox.alert.calledWith(I18n.t("post.errors.too_many_uploads"))); @@ -44,7 +44,7 @@ discourseModule("Unit | Utility | uploads", function () { this.siteSettings.newuser_max_embedded_media = 0; sinon.stub(bootbox, "alert"); - assert.not( + assert.notOk( validateUploadedFiles([{ name: "image.png" }], { user: User.create(), siteSettings: this.siteSettings, @@ -88,7 +88,7 @@ discourseModule("Unit | Utility | uploads", function () { this.siteSettings.newuser_max_attachments = 0; sinon.stub(bootbox, "alert"); - assert.not( + assert.notOk( validateUploadedFiles([{ name: "roman.txt" }], { user: User.create(), siteSettings: this.siteSettings, @@ -103,7 +103,7 @@ discourseModule("Unit | Utility | uploads", function () { test("ensures an authorized upload", function (assert) { sinon.stub(bootbox, "alert"); - assert.not( + assert.notOk( validateUploadedFiles([{ name: "unauthorized.html" }], { siteSettings: this.siteSettings, }) @@ -124,7 +124,7 @@ discourseModule("Unit | Utility | uploads", function () { const files = [{ name: "backup.tar.gz" }]; sinon.stub(bootbox, "alert"); - assert.not( + assert.notOk( validateUploadedFiles(files, { skipValidation: false, siteSettings: this.siteSettings, @@ -144,7 +144,7 @@ discourseModule("Unit | Utility | uploads", function () { sinon.stub(bootbox, "alert"); let user = User.create({ moderator: true }); - assert.not( + assert.notOk( validateUploadedFiles(files, { user, siteSettings: this.siteSettings }) ); assert.ok( @@ -193,7 +193,7 @@ discourseModule("Unit | Utility | uploads", function () { }) ); - assert.not(bootbox.alert.calledOnce); + assert.notOk(bootbox.alert.calledOnce); }); test("isImage", function (assert) { @@ -205,9 +205,9 @@ discourseModule("Unit | Utility | uploads", function () { image + " is recognized as an image" ); }); - assert.not(isImage("file.txt")); - assert.not(isImage("http://foo.bar/path/to/file.txt")); - assert.not(isImage("")); + assert.notOk(isImage("file.txt")); + assert.notOk(isImage("http://foo.bar/path/to/file.txt")); + assert.notOk(isImage("")); }); test("allowsImages", function (assert) { @@ -235,7 +235,7 @@ discourseModule("Unit | Utility | uploads", function () { test("allowsAttachments", function (assert) { this.siteSettings.authorized_extensions = "jpg|jpeg|gif"; - assert.not( + assert.notOk( allowsAttachments(false, this.siteSettings), "no attachments allowed by default" ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/url-test.js b/app/assets/javascripts/discourse/tests/unit/lib/url-test.js index 61ee568ec0a..e70e65b42ce 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/url-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/url-test.js @@ -13,7 +13,7 @@ module("Unit | Utility | url", function () { test("isInternal with a HTTP url", function (assert) { sinon.stub(DiscourseURL, "origin").returns("http://eviltrout.com"); - assert.not(DiscourseURL.isInternal(null), "a blank URL is not internal"); + assert.notOk(DiscourseURL.isInternal(null), "a blank URL is not internal"); assert.ok(DiscourseURL.isInternal("/test"), "relative URLs are internal"); assert.ok( DiscourseURL.isInternal("//eviltrout.com"), @@ -27,11 +27,11 @@ module("Unit | Utility | url", function () { DiscourseURL.isInternal("https://eviltrout.com/moustache"), "a url on a HTTPS of the same host is internal" ); - assert.not( + assert.notOk( DiscourseURL.isInternal("//twitter.com.com"), "a different host is not internal (protocol-less)" ); - assert.not( + assert.notOk( DiscourseURL.isInternal("http://twitter.com"), "a different host is not internal" ); @@ -47,11 +47,11 @@ module("Unit | Utility | url", function () { test("isInternal on subfolder install", function (assert) { sinon.stub(DiscourseURL, "origin").returns("http://eviltrout.com/forum"); - assert.not( + assert.notOk( DiscourseURL.isInternal("http://eviltrout.com"), "the host root is not internal" ); - assert.not( + assert.notOk( DiscourseURL.isInternal("http://eviltrout.com/tophat"), "a url on the same host but on a different folder is not internal" ); diff --git a/app/assets/javascripts/discourse/tests/unit/mixins/grant-badge-controller-test.js b/app/assets/javascripts/discourse/tests/unit/mixins/grant-badge-controller-test.js index 8b939bd9de3..cb56f1812ec 100644 --- a/app/assets/javascripts/discourse/tests/unit/mixins/grant-badge-controller-test.js +++ b/app/assets/javascripts/discourse/tests/unit/mixins/grant-badge-controller-test.js @@ -60,11 +60,11 @@ module("Unit | Mixin | grant-badge-controller", function (hooks) { .get("grantableBadges") .map((badge) => badge.name); - assert.not( + assert.notOk( badgeNames.includes(this.badgeDisabled), "excludes disabled badges" ); - assert.not( + assert.notOk( badgeNames.includes(this.badgeAutomatic), "excludes automatic badges" ); @@ -73,7 +73,7 @@ module("Unit | Mixin | grant-badge-controller", function (hooks) { test("selectedBadgeGrantable", function (assert) { this.subject.set("selectedBadgeId", this.badgeDisabled.id); - assert.not(this.subject.get("selectedBadgeGrantable")); + assert.notOk(this.subject.get("selectedBadgeGrantable")); this.subject.set("selectedBadgeId", this.badgeFirst.id); assert.ok(this.subject.get("selectedBadgeGrantable")); 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 84e9a3f96c2..5b5446eb3c9 100644 --- a/app/assets/javascripts/discourse/tests/unit/models/topic-test.js +++ b/app/assets/javascripts/discourse/tests/unit/models/topic-test.js @@ -20,7 +20,7 @@ discourseModule("Unit | Model | topic", function () { last_read_post_number: 1, }); - assert.not( + assert.notOk( topic.get("visited"), "not visited unless we've read all the posts" ); 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 5b8a6a47262..751ba857335 100644 --- a/app/assets/javascripts/discourse/tests/unit/models/user-test.js +++ b/app/assets/javascripts/discourse/tests/unit/models/user-test.js @@ -108,7 +108,7 @@ module("Unit | Model | user", function () { undefined, "if the user has no timezone and the user is not the current user, do NOT guess with moment" ); - assert.not( + assert.notOk( spy.calledWith("/u/howardhamlin.json", { type: "PUT", dataType: "json",