import User from "discourse/models/user"; import { render } from "@ember/test-helpers"; import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message"; import { exists } from "discourse/tests/helpers/qunit-helpers"; import { setupRenderingTest } from "discourse/tests/helpers/component-test"; import hbs from "htmlbars-inline-precompile"; import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel"; import { module, test } from "qunit"; module("Discourse Chat | Component | chat-message", function (hooks) { setupRenderingTest(hooks); function generateMessageProps(messageData = {}) { const chatChannel = ChatChannel.create({ chatable: { id: 1 }, chatable_type: "Category", id: 9, title: "Site", last_message_sent_at: "2021-11-08T21:26:05.710Z", current_user_membership: { unread_count: 0, muted: false, }, canDeleteSelf: true, canDeleteOthers: true, canFlag: true, userSilenced: false, canModerate: true, }); return { message: ChatMessage.create( chatChannel, Object.assign( { id: 178, message: "from deleted user", cooked: "
from deleted user
", excerpt: "from deleted user
", created_at: "2021-07-22T08:14:16.950Z", flag_count: 0, user: User.create({ username: "someguy", id: 1424 }), edited: false, }, messageData ) ), chatChannel, afterExpand: () => {}, onHoverMessage: () => {}, messageDidEnterViewport: () => {}, messageDidLeaveViewport: () => {}, }; } const template = hbs`