mirror of
https://github.com/discourse/discourse.git
synced 2024-12-03 18:43:43 +08:00
24 lines
743 B
JavaScript
24 lines
743 B
JavaScript
|
import { module, test } from "qunit";
|
||
|
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||
|
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||
|
|
||
|
module("Discourse Chat | Unit | Models | chat-message", function () {
|
||
|
test(".persisted", function (assert) {
|
||
|
const channel = fabricators.channel();
|
||
|
let message = ChatMessage.create(channel, { id: null });
|
||
|
assert.strictEqual(message.persisted, false);
|
||
|
|
||
|
message = ChatMessage.create(channel, {
|
||
|
id: 1,
|
||
|
staged: true,
|
||
|
});
|
||
|
assert.strictEqual(message.persisted, false);
|
||
|
|
||
|
message = ChatMessage.create(channel, {
|
||
|
id: 1,
|
||
|
staged: false,
|
||
|
});
|
||
|
assert.strictEqual(message.persisted, true);
|
||
|
});
|
||
|
});
|