discourse/plugins/chat/test/javascripts/unit/services/chat-channel-info-route-origin-manager-test.js
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

46 lines
1.4 KiB
JavaScript

import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { ORIGINS } from "discourse/plugins/chat/discourse/services/chat-channel-info-route-origin-manager";
module(
"Discourse Chat | Unit | Service | chat-channel-info-route-origin-manager",
function (hooks) {
hooks.beforeEach(function () {
this.manager = getOwner(this).lookup(
"service:chat-channel-info-route-origin-manager"
);
});
hooks.afterEach(function () {
this.manager.origin = null;
});
test(".origin", function (assert) {
this.manager.origin = ORIGINS.channnel;
assert.strictEqual(this.manager.origin, ORIGINS.channnel);
});
test(".isBrowse", function (assert) {
this.manager.origin = ORIGINS.browse;
assert.strictEqual(this.manager.isBrowse, true);
this.manager.origin = null;
assert.strictEqual(this.manager.isBrowse, false);
this.manager.origin = ORIGINS.channel;
assert.strictEqual(this.manager.isBrowse, false);
});
test(".isChannel", function (assert) {
this.manager.origin = ORIGINS.channnel;
assert.strictEqual(this.manager.isChannel, true);
this.manager.origin = ORIGINS.browse;
assert.strictEqual(this.manager.isChannel, false);
this.manager.origin = null;
assert.strictEqual(this.manager.isChannel, true);
});
}
);