mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 05:03:04 +08:00
The complexity of the situation is that we don't want to load faker into production by default but fabricators and styleguide are available on production. This is made possible through app/assets/javascripts/discourse/app/lib/load-faker.js which contains a function to ensure faker is loaded asynchronously (loadFaker) and another function to access the loaded faker (getLoadedFaker). Note 1: this commit also refactors fabricators to have access to context and use faker where possible Note 2: this commit moves automation to admin bundle --------- Co-authored-by: David Taylor <david@taylorhq.com>
27 lines
885 B
JavaScript
Vendored
27 lines
885 B
JavaScript
Vendored
import { getOwner } from "@ember/application";
|
|
import { setupTest } from "ember-qunit";
|
|
import { module, test } from "qunit";
|
|
import ChatFabricators 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 (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test(".persisted", function (assert) {
|
|
const channel = new ChatFabricators(getOwner(this)).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);
|
|
});
|
|
});
|