2022-11-02 21:41:30 +08:00
|
|
|
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
2022-12-22 21:35:18 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
2022-11-02 21:41:30 +08:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
|
|
|
import I18n from "I18n";
|
2022-12-22 21:35:18 +08:00
|
|
|
import { module, test } from "qunit";
|
|
|
|
import { render } from "@ember/test-helpers";
|
2022-11-02 21:41:30 +08:00
|
|
|
|
|
|
|
module(
|
|
|
|
"Discourse Chat | Component | chat-retention-reminder",
|
|
|
|
function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2023-02-15 21:50:01 +08:00
|
|
|
test("display retention info", async function (assert) {
|
|
|
|
this.channel = ChatChannel.create({ chatable_type: "Category" });
|
2022-12-22 21:35:18 +08:00
|
|
|
this.currentUser.set("needs_channel_retention_reminder", true);
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-03-02 23:59:11 +08:00
|
|
|
await render(
|
|
|
|
hbs`<ChatRetentionReminder @chatChannel={{this.channel}} />`
|
|
|
|
);
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-02-15 21:50:01 +08:00
|
|
|
assert.dom(".chat-retention-reminder").includesText(
|
|
|
|
I18n.t("chat.retention_reminders.public", {
|
|
|
|
count: this.siteSettings.chat_channel_retention_days,
|
|
|
|
})
|
2022-12-22 21:35:18 +08:00
|
|
|
);
|
2022-11-02 21:41:30 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|