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/models/theme-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

23 lines
670 B
JavaScript

import { module, test } from "qunit";
import Theme from "admin/models/theme";
module("Unit | Model | theme");
test("can add an upload correctly", function (assert) {
let theme = Theme.create();
assert.equal(
theme.get("uploads.length"),
0,
"uploads should be an empty array"
);
theme.setField("common", "bob", "", 999, 2);
let fields = theme.get("theme_fields");
assert.equal(fields.length, 1, "expecting 1 theme field");
assert.equal(fields[0].upload_id, 999, "expecting upload id to be set");
assert.equal(fields[0].type_id, 2, "expecting type id to be set");
assert.equal(theme.get("uploads.length"), 1, "expecting an upload");
});