This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/unit/controllers/admin-customize-themes-show-test.js
Robin Ward 11e6e9cca2
FIX: Tests in admin/tests were not running (#12391)
Since we want to run them in the core app they've been moved into the
`tests` directory for discourse, and updated to the latest format.
2021-03-17 13:02:12 -04:00

48 lines
1.4 KiB
JavaScript

import Theme from "admin/models/theme";
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
discourseModule("Unit | Controller | admin-customize-themes-show", function () {
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,
default: true,
name: "default",
remote_theme: {
remote_url: repoUrl,
},
});
const controller = this.getController("admin-customize-themes-show", {
model: remoteTheme,
});
assert.deepEqual(
controller.get("remoteThemeLink"),
repoUrl,
"returns theme's repo URL"
);
});
test("can display source url for remote theme branches", function (assert) {
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.getController("admin-customize-themes-show", {
model: remoteTheme,
});
assert.deepEqual(
controller.get("remoteThemeLink"),
"https://github.com/discourse/discourse-brand-header/tree/beta",
"returns theme's repo URL to branch"
);
});
});