Skip to content

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

DEV: Remove the deprecated componentTest helper (#31649)

Jarek Radosz0684ac64f20c
diff --git a/app/assets/javascripts/discourse/tests/helpers/component-test.js b/app/assets/javascripts/discourse/tests/helpers/component-test.js
index 5f0d8853455..41bd84dc5d9 100644
--- a/app/assets/javascripts/discourse/tests/helpers/component-test.js
+++ b/app/assets/javascripts/discourse/tests/helpers/component-test.js
@@ -1,9 +1,6 @@
-import { render } from "@ember/test-helpers";
import { setupRenderingTest as emberSetupRenderingTest } from "ember-qunit";
-import QUnit, { test } from "qunit";
import { autoLoadModules } from "discourse/instance-initializers/auto-load-modules";
import { AUTO_GROUPS } from "discourse/lib/constants";
-import deprecated from "discourse/lib/deprecated";
import Session from "discourse/models/session";
import Site from "discourse/models/site";
import TopicTrackingState from "discourse/models/topic-tracking-state";
@@ -50,52 +47,3 @@ export function setupRenderingTest(hooks) {
this.owner.lookup("service:store");
});
}
-
-export default function (name, hooks, opts) {
- deprecated(
- `\`componentTest\` is deprecated. Use QUnit's \`test\` and \`setupRenderingTest\` from "discourse/tests/helpers/component-test" instead.`,
- {
- id: "discourse.component-test",
- since: "3.4.0.beta3-dev",
- }
- );
-
- if (opts === undefined) {
- opts = hooks;
- }
-
- opts = opts || {};
-
- if (opts.skip) {
- return;
- }
-
- if (typeof opts.template === "string") {
- let testName = QUnit.config.currentModule.name + " " + name;
- // eslint-disable-next-line
- console.warn(
- `${testName} skipped; template must be compiled and not a string`
- );
- return;
- }
-
- test(name, async function (assert) {
- if (opts.anonymous) {
- this.owner.unregister("service:current-user");
- }
-
- if (opts.beforeEach) {
- const store = this.owner.lookup("service:store");
- await opts.beforeEach.call(this, store);
- }
-
- try {
- await render(opts.template);
- await opts.test.call(this, assert);
- } finally {
- if (opts.afterEach) {
- await opts.afterEach.call(opts);
- }
- }
- });
-}