Files
discourse/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs
David Taylor 999ae73c78 DEV: [gjs-codemod] apply codemod
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-02 13:44:15 +01:00

50 lines
1.6 KiB
Plaintext

import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { i18n } from "discourse-i18n";
import ChatRetentionReminder from "discourse/plugins/chat/discourse/components/chat-retention-reminder";
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
module(
"Discourse Chat | Component | chat-retention-reminder",
function (hooks) {
setupRenderingTest(hooks);
test("display retention info", async function (assert) {
const self = this;
this.channel = ChatChannel.create({ chatable_type: "Category" });
this.currentUser.set("needs_channel_retention_reminder", true);
await render(
<template><ChatRetentionReminder @channel={{self.channel}} /></template>
);
assert.dom(".chat-retention-reminder").includesText(
i18n("chat.retention_reminders.long", {
count: this.siteSettings.chat_channel_retention_days,
})
);
});
test("@type=short", async function (assert) {
const self = this;
this.channel = ChatChannel.create({ chatable_type: "Category" });
this.currentUser.set("needs_channel_retention_reminder", true);
await render(
<template>
<ChatRetentionReminder @channel={{self.channel}} @type="short" />
</template>
);
assert.dom(".chat-retention-reminder").includesText(
i18n("chat.retention_reminders.short", {
count: this.siteSettings.chat_channel_retention_days,
})
);
});
}
);