mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 16:53:43 +08:00
038e5deb2a
* `@ember/owner` instead of `@ember/application` * `discourse-i18n` instead of `I18n` * `{ service } from "@ember/service"` instead of `inject as service`
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import { getOwner } from "@ember/owner";
|
|
import { setupTest } from "ember-qunit";
|
|
import { module, test } from "qunit";
|
|
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) {
|
|
setupTest(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.channel;
|
|
assert.strictEqual(this.manager.origin, ORIGINS.channel);
|
|
});
|
|
|
|
test(".isBrowse", function (assert) {
|
|
this.manager.origin = ORIGINS.browse;
|
|
assert.true(this.manager.isBrowse);
|
|
|
|
this.manager.origin = null;
|
|
assert.false(this.manager.isBrowse);
|
|
|
|
this.manager.origin = ORIGINS.channel;
|
|
assert.false(this.manager.isBrowse);
|
|
});
|
|
|
|
test(".isChannel", function (assert) {
|
|
this.manager.origin = ORIGINS.channel;
|
|
assert.true(this.manager.isChannel);
|
|
|
|
this.manager.origin = ORIGINS.browse;
|
|
assert.false(this.manager.isChannel);
|
|
|
|
this.manager.origin = null;
|
|
assert.true(this.manager.isChannel);
|
|
});
|
|
}
|
|
);
|