Skip to content

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

Make qunit test code more clean.

Vinoth Kannanbef8468510fe
diff --git a/test/javascripts/admin/controllers/admin-customize-themes-show-test.js.es6 b/test/javascripts/admin/controllers/admin-customize-themes-show-test.js.es6
index 3e9c0f90060..63a9453e36d 100644
--- a/test/javascripts/admin/controllers/admin-customize-themes-show-test.js.es6
+++ b/test/javascripts/admin/controllers/admin-customize-themes-show-test.js.es6
@@ -8,18 +8,16 @@ moduleFor("controller:admin-customize-themes-show", {
needs: ["controller:adminUser"]
});
-const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
-const remoteTheme = Theme.create({
- id: 2,
- default: true,
- name: "default",
- remote_theme: {
- remote_url: repoUrl
- }
-});
-
QUnit.test("can display source url for remote themes", function(assert) {
- delete remoteTheme["remote_theme"]["branch"];
+ const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
+ const remoteTheme = Theme.create({
+ id: 2,
+ default: true,
+ name: "default",
+ remote_theme: {
+ remote_url: repoUrl
+ }
+ });
const controller = this.subject({
model: remoteTheme
});
@@ -34,17 +32,22 @@ QUnit.test("can display source url for remote themes", function(assert) {
QUnit.test("can display source url for remote theme branches", function(
assert
) {
- const branchUrl =
- "https://github.com/discourse/discourse-brand-header/tree/beta";
- remoteTheme["remote_theme"]["branch"] = "beta";
-
+ const remoteTheme = Theme.create({
+ id: 2,
+ default: true,
+ name: "default",
+ remote_theme: {
+ remote_url: "https://github.com/discourse/discourse-brand-header.git",
+ branch: "beta"
+ }
+ });
const controller = this.subject({
model: remoteTheme
});
assert.deepEqual(
controller.get("remoteThemeLink"),
- branchUrl,
+ "https://github.com/discourse/discourse-brand-header/tree/beta",
"returns theme's repo URL to branch"
);
});