REFACTOR: Import QUnit and related helpers rather than globals

We used many global functions to handle tests when they should be
imported like other libraries in our application. This also gets us
closer to the way Ember CLI prefers our tests to be laid out.
This commit is contained in:
Robin Ward
2020-10-06 12:54:05 -04:00
parent c0293339b8
commit 71d37953d5
238 changed files with 2384 additions and 2406 deletions
@@ -1,3 +1,4 @@
import { moduleForComponent } from "ember-qunit";
import EmberObject from "@ember/object";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import componentTest from "discourse/tests/helpers/component-test";
@@ -1,3 +1,4 @@
import { moduleForComponent } from "ember-qunit";
import I18n from "I18n";
import componentTest from "discourse/tests/helpers/component-test";
import Theme from "admin/models/theme";
@@ -1,3 +1,4 @@
import { moduleForComponent } from "ember-qunit";
import I18n from "I18n";
import componentTest from "discourse/tests/helpers/component-test";
import Theme, { THEMES, COMPONENTS } from "admin/models/theme";
@@ -1,3 +1,5 @@
import { moduleFor } from "ember-qunit";
import { test } from "qunit";
import { mapRoutes } from "discourse/mapping-router";
import Theme from "admin/models/theme";
@@ -8,7 +10,7 @@ moduleFor("controller:admin-customize-themes-show", {
needs: ["controller:adminUser"],
});
QUnit.test("can display source url for remote themes", function (assert) {
test("can display source url for remote themes", function (assert) {
const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
const remoteTheme = Theme.create({
id: 2,
@@ -29,9 +31,7 @@ QUnit.test("can display source url for remote themes", function (assert) {
);
});
QUnit.test("can display source url for remote theme branches", function (
assert
) {
test("can display source url for remote theme branches", function (assert) {
const remoteTheme = Theme.create({
id: 2,
default: true,
@@ -1,3 +1,5 @@
import { moduleFor } from "ember-qunit";
import { test } from "qunit";
import { mapRoutes } from "discourse/mapping-router";
import Theme from "admin/models/theme";
@@ -8,7 +10,7 @@ moduleFor("controller:admin-customize-themes", {
needs: ["controller:adminUser"],
});
QUnit.test("can list themes correctly", function (assert) {
test("can list themes correctly", function (assert) {
const defaultTheme = Theme.create({ id: 2, default: true, name: "default" });
const userTheme = Theme.create({
id: 3,
@@ -1,3 +1,5 @@
import { moduleFor } from "ember-qunit";
import { test } from "qunit";
import Badge from "discourse/models/badge";
import { mapRoutes } from "discourse/mapping-router";
@@ -8,7 +10,7 @@ moduleFor("controller:admin-user-badges", {
needs: ["controller:adminUser"],
});
QUnit.test("grantableBadges", function (assert) {
test("grantableBadges", function (assert) {
const badgeFirst = Badge.create({
id: 3,
name: "A Badge",
@@ -1,8 +1,9 @@
import { test, module } from "qunit";
import Theme from "admin/models/theme";
QUnit.module("model:theme");
module("model:theme");
QUnit.test("can add an upload correctly", function (assert) {
test("can add an upload correctly", function (assert) {
let theme = Theme.create();
assert.equal(