A platform for community discussion. Free, open, simple.
DEV: Use `test`-provided `assert` object (#29794)
Jarek Radosz6e68de79d253
diff --git a/app/assets/javascripts/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.js b/app/assets/javascripts/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.jsindex bb5e91046a2..8eb3a54ff16 100644--- a/app/assets/javascripts/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.js+++ b/app/assets/javascripts/discourse/tests/addons/truth-helpers/integration/helpers/includes-test.js@@ -1,12 +1,12 @@import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";-import { assert, module, test } from "qunit";+import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";module("Addons | truth-helpers | Integration | includes", function (hooks) {setupRenderingTest(hooks);- test("when using an array", async function () {+ test("when using an array", async function (assert) {this.foo = [1];this.bar = 1;await render(@@ -23,7 +23,7 @@ module("Addons | truth-helpers | Integration | includes", function (hooks) {assert.dom(".test").doesNotExist("is false when element is not found");});- test("when using a string", async function () {+ test("when using a string", async function (assert) {this.foo = "foo";this.bar = "f";await render(diff --git a/app/assets/javascripts/discourse/tests/integration/component-templates-test.gjs b/app/assets/javascripts/discourse/tests/integration/component-templates-test.gjsindex d30547db116..8038c6f5f6b 100644--- a/app/assets/javascripts/discourse/tests/integration/component-templates-test.gjs+++ b/app/assets/javascripts/discourse/tests/integration/component-templates-test.gjs@@ -2,7 +2,7 @@ import Component from "@glimmer/component";import { setComponentTemplate } from "@glimmer/manager";import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";-import { assert, module, test } from "qunit";+import { module, test } from "qunit";import sinon from "sinon";import { overrideThrowGjsError } from "discourse/instance-initializers/component-templates";import { forceMobile } from "discourse/lib/mobile";@@ -122,14 +122,14 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(() => registerTemplateOnlyComponents());setupRenderingTest(hooks);- test("treats plugin template-only definition as classic component", async function () {+ test("treats plugin template-only definition as classic component", async function (assert) {await render(hbs`<PluginTemplateOnlyDefinition class='test-class'/>`);assert.dom("div.test-class").hasText("classic component", "renders as classic component");});- test("leaves core template-only definition as glimmer template-only component", async function () {+ test("leaves core template-only definition as glimmer template-only component", async function (assert) {await render(hbs`<CoreTemplateOnlyDefinition class='test-class'/>`);assert.dom("div.test-class")@@ -142,7 +142,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(() => registerBaseComponents());setupRenderingTest(hooks);- test("renders core templates when there are no overrides", async function () {+ test("renders core templates when there are no overrides", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -161,7 +161,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {setupRenderingTest(hooks);- test("core mobile overrides are used", async function () {+ test("core mobile overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -177,7 +177,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(registerThemeOverrides);setupRenderingTest(hooks);- test("theme overrides are used", async function () {+ test("theme overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -197,7 +197,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {setupRenderingTest(hooks);- test("mobile theme overrides are used", async function () {+ test("mobile theme overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -219,7 +219,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(registerPluginOverrides);setupRenderingTest(hooks);- test("plugin overrides are used", async function () {+ test("plugin overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -236,7 +236,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(registerThemeOverrides);setupRenderingTest(hooks);- test("plugin overrides are used", async function () {+ test("plugin overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -253,7 +253,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(registerOtherPluginOverrides);setupRenderingTest(hooks);- test("last-defined plugin overrides are used", async function () {+ test("last-defined plugin overrides are used", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -277,7 +277,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {hooks.beforeEach(registerThemeOverrides);setupRenderingTest(hooks);- test("theme overrides plugin component", async function () {+ test("theme overrides plugin component", async function (assert) {await render(TestTemplate);assert.dom("#mock-colocated")@@ -319,7 +319,7 @@ module("Integration | Initializers | plugin-component-templates", function (h) {setupRenderingTest(hooks);- test("theme overrides plugin component", async function () {+ test("theme overrides plugin component", async function (assert) {await render(hbs`<MockGjsComponent />`);assert.dom(".greeting")diff --git a/app/assets/javascripts/discourse/tests/integration/helpers/category-link-test.js b/app/assets/javascripts/discourse/tests/integration/helpers/category-link-test.jsindex 8188d2d4d03..9594de17431 100644--- a/app/assets/javascripts/discourse/tests/integration/helpers/category-link-test.js+++ b/app/assets/javascripts/discourse/tests/integration/helpers/category-link-test.js@@ -1,18 +1,18 @@import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";-import { assert, module, test } from "qunit";+import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";module("Integration | Helper | category-link", function (hooks) {setupRenderingTest(hooks);- test("name", async function () {+ test("name", async function (assert) {await render(hbs`{{category-link (hash name="foo")}}`);assert.dom(".badge-category__name").hasText("foo");});- test("description_text", async function () {+ test("description_text", async function (assert) {await render(hbs`{{category-link (hash name="foo" description_text="bar")}}`);diff --git a/app/assets/javascripts/discourse/tests/integration/helpers/concat-class-test.js b/app/assets/javascripts/discourse/tests/integration/helpers/concat-class-test.jsindex 0a01e7cd7dc..190c0953ee6 100644--- a/app/assets/javascripts/discourse/tests/integration/helpers/concat-class-test.js+++ b/app/assets/javascripts/discourse/tests/integration/helpers/concat-class-test.js@@ -1,39 +1,39 @@import { render } from "@ember/test-helpers";import { hbs } from "ember-cli-htmlbars";-import { assert, module, test } from "qunit";+import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";module("Integration | Helper | concat-class", function (hooks) {setupRenderingTest(hooks);- test("One class given", async function () {+ test("One class given", async function (assert) {await render(hbs`<button class={{concat-class "foo"}} />`);assert.dom("button").hasAttribute("class", "foo");});- test("Multiple class given", async function () {+ test("Multiple class given", async function (assert) {this.set("bar", "bar");await render(hbs`<button class={{concat-class "foo" this.bar}} />`);assert.dom("button").hasAttribute("class", "foo bar");});- test("One undefined class given", async function () {+ test("One undefined class given", async function (assert) {this.set("bar", null);await render(hbs`<button class={{concat-class "foo" this.bar}} />`);assert.dom("button").hasAttribute("class", "foo");});- test("Only undefined class given", async function () {+ test("Only undefined class given", async function (assert) {this.set("bar", null);await render(hbs`<button class={{concat-class null this.bar}} />`);assert.dom("button").doesNotHaveAttribute("class");});- test("Helpers used", async function () {+ test("Helpers used", async function (assert) {await render(hbs`<button class={{concat-class (if true "foo") (if true "bar")}} />`);@@ -41,7 +41,7 @@ module("Integration | Helper | concat-class", function (hooks) {assert.dom("button").hasAttribute("class", "foo bar");});- test("Arrays", async function () {+ test("Arrays", async function (assert) {await render(hbs`<button class={{concat-class (array) (array "foo" "bar") (array null)}} />`);