0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/discourse-calendar/test/javascripts/integration/components/admin-holidays-list-test.gjs
Martin Brennan 79d1c792eb
DEV: Update test module name conventions (#40389)
Currently, most of the JS test modules follow this
convention:

```
module("Integration | Component | topic-dismiss-buttons"
```

Which is a legacy from when ember components etc were
rendered in templates like this:

```
{{d-button title="foo"}}
```

Instead, this commit updates all of them to follow this
PascalCase convention:

```
module("Integration | Component | TopicDismissButtons", function (hooks) {
```

No linting is added to enforce this, we suspect that it's
mostly a result of cargo culting, and people will add new
tests following PascalCase convention.

Also adds an initial AI skill for writing JS tests.
2026-05-29 15:19:55 +10:00

36 lines
1.3 KiB
Text
Vendored

import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import AdminHolidaysList from "discourse/plugins/discourse-calendar/discourse/components/admin-holidays-list";
module("Integration | Component | AdminHolidaysList", function (hooks) {
setupRenderingTest(hooks);
test("displaying a list of the provided holidays", async function (assert) {
this.set("holidays", [
{ date: "2022-01-01", name: "New Year's Day" },
{ date: "2022-01-17", name: "Martin Luther King, Jr. Day" },
]);
await render(
<template><AdminHolidaysList @holidays={{this.holidays}} /></template>
);
assert
.dom("table tbody tr:nth-child(1) td:nth-child(1)")
.hasText("2022-01-01", "it displays the first holiday date");
assert
.dom("table tbody tr:nth-child(1) td:nth-child(2)")
.hasText("New Year's Day", "it displays the first holiday name");
assert
.dom("table tbody tr:nth-child(2) td:nth-child(1)")
.hasText("2022-01-17", "it displays the second holiday date");
assert
.dom("table tbody tr:nth-child(2) td:nth-child(2)")
.hasText(
"Martin Luther King, Jr. Day",
"it displays the second holiday name"
);
});
});