DEV: Use the block form of `module()` (#17151)

This commit is contained in:
Jarek Radosz 2022-06-20 15:42:10 +02:00 committed by GitHub
parent 321118f384
commit ba2c7b8f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 713 additions and 709 deletions

View File

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

View File

@ -1,8 +1,6 @@
import PrettyText, { buildOptions } from "pretty-text/pretty-text";
import { module, test } from "qunit";
module("lib:details-cooked-test");
const defaultOpts = buildOptions({
siteSettings: {
enable_emoji: true,
@ -14,6 +12,7 @@ const defaultOpts = buildOptions({
getURL: (url) => url,
});
module("lib:details-cooked-test", function () {
test("details", function (assert) {
const cooked = (input, expected, text) => {
assert.strictEqual(
@ -37,3 +36,4 @@ testing</summary>
</details>`
);
});
});

View File

@ -4,8 +4,6 @@ import { module, test } from "qunit";
const PARIS = "Europe/Paris";
const SYDNEY = "Australia/Sydney";
module("lib:date-with-zone-helper");
function buildDateHelper(params = {}) {
return new DateWithZoneHelper({
year: params.year || 2020,
@ -18,6 +16,7 @@ function buildDateHelper(params = {}) {
});
}
module("lib:date-with-zone-helper", function () {
test("#format", function (assert) {
let date = buildDateHelper({
day: 15,
@ -167,3 +166,4 @@ test("#add", function (assert) {
"it correctly adds from a isDST date to a !isDST date"
);
});
});

View File

@ -11,8 +11,6 @@ const PARIS = "Europe/Paris";
const LAGOS = "Africa/Lagos";
const LONDON = "Europe/London";
module("lib:local-date-builder");
function freezeTime({ date, timezone }, cb) {
date = date || "2020-01-22 10:34";
const newTimezone = timezone || PARIS;
@ -50,7 +48,7 @@ QUnit.assert.buildsCorrectDate = function (options, expected, message) {
this.test.assert.strictEqual(
localDateBuilder.build().formated,
expected.formated,
message || "it formates the date correctly"
message || "it formats the date correctly"
);
}
@ -58,11 +56,12 @@ QUnit.assert.buildsCorrectDate = function (options, expected, message) {
this.test.assert.deepEqual(
localDateBuilder.build().previews,
expected.previews,
message || "it formates the previews correctly"
message || "it formats the previews correctly"
);
}
};
module("lib:local-date-builder", function () {
test("date", function (assert) {
freezeTime({ date: "2020-03-11" }, () => {
assert.buildsCorrectDate(
@ -251,7 +250,7 @@ test("option[recurring]", function (assert) {
});
});
test("option[countown]", function (assert) {
test("option[countdown]", function (assert) {
freezeTime({ date: "2020-03-21 23:59" }, () => {
assert.buildsCorrectDate(
{
@ -343,7 +342,7 @@ test("option[calendar]", function (assert) {
assert.buildsCorrectDate(
{ date: "2020-03-21", timezone: PARIS },
{ formated: "March 21, 2020" },
"it stops formating out of calendar range"
"it stops formatting out of calendar range"
)
);
@ -416,7 +415,7 @@ test("previews", function (assert) {
freezeTime({ date: "2020-03-22", timezone: PARIS }, () => {
assert.buildsCorrectDate(
{ timezone: PARIS, isplayedTimezone: PARIS },
{ timezone: PARIS, displayedTimezone: PARIS },
{
previews: [
{
@ -590,3 +589,4 @@ test("previews", function (assert) {
);
});
});
});