2022-11-02 21:41:30 +08:00
|
|
|
import { render } from "@ember/test-helpers";
|
2023-10-11 02:38:59 +08:00
|
|
|
import hbs from "htmlbars-inline-precompile";
|
|
|
|
import { module, test } from "qunit";
|
2022-11-02 21:41:30 +08:00
|
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
2023-05-17 23:49:52 +08:00
|
|
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
2022-11-02 21:41:30 +08:00
|
|
|
|
|
|
|
module("Discourse Chat | Unit | Helpers | format-chat-date", function (hooks) {
|
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
test("link to chat message", async function (assert) {
|
2023-05-17 23:49:52 +08:00
|
|
|
const channel = fabricators.channel();
|
|
|
|
this.message = fabricators.message({ channel });
|
2023-03-03 20:09:25 +08:00
|
|
|
|
2023-02-15 15:27:09 +08:00
|
|
|
await render(hbs`{{format-chat-date this.message}}`);
|
2022-11-02 21:41:30 +08:00
|
|
|
|
2023-05-17 23:49:52 +08:00
|
|
|
assert.equal(
|
|
|
|
query(".chat-time").getAttribute("href"),
|
|
|
|
`/chat/c/-/${channel.id}/${this.message.id}`
|
|
|
|
);
|
2022-11-02 21:41:30 +08:00
|
|
|
});
|
|
|
|
});
|