DEV: Modernize chat getOwner usage (#23671)

See 8958b4f76af85ddc89c8a3b6434dcfbd4274d569 for motivation
This commit is contained in:
David Taylor
2023-09-26 18:05:34 +01:00
committed by GitHub
parent 52722c7086
commit a673004777
19 changed files with 40 additions and 26 deletions

View File

@ -1,7 +1,10 @@
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import { setupTest } from "ember-qunit";
module("Discourse Chat | Unit | chat-emoji-reaction-store", function (hooks) {
setupTest(hooks);
hooks.beforeEach(function () {
this.siteSettings = getOwner(this).lookup("service:site-settings");
this.chatEmojiReactionStore = getOwner(this).lookup(

View File

@ -1,10 +1,13 @@
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import { ORIGINS } from "discourse/plugins/chat/discourse/services/chat-channel-info-route-origin-manager";
import { setupTest } from "ember-qunit";
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"

View File

@ -1,6 +1,6 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
module(

View File

@ -1,7 +1,10 @@
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import { setupTest } from "ember-qunit";
module("Discourse Chat | Unit | Service | chat-drawer-size", function (hooks) {
setupTest(hooks);
hooks.beforeEach(function () {
this.subject = getOwner(this).lookup("service:chat-drawer-size");
});

View File

@ -1,7 +1,8 @@
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import pretender from "discourse/tests/helpers/create-pretender";
import { settled } from "@ember/test-helpers";
import { setupTest } from "ember-qunit";
function emojisReponse() {
return { favorites: [{ name: "sad" }] };
@ -10,6 +11,8 @@ function emojisReponse() {
module(
"Discourse Chat | Unit | Service | chat-emoji-picker-manager",
function (hooks) {
setupTest(hooks);
hooks.beforeEach(function () {
pretender.get("/chat/emojis.json", () => {
return [200, {}, emojisReponse()];

View File

@ -2,7 +2,7 @@ import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import Site from "discourse/models/site";
import sinon from "sinon";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import {
addChatDrawerStateCallback,
resetChatDrawerStateCallbacks,

View File

@ -1,6 +1,6 @@
import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
import { getOwner } from "discourse-common/lib/get-owner";
import { getOwner } from "@ember/application";
import { withPluginApi } from "discourse/lib/plugin-api";
import User from "discourse/models/user";
import ChatMessageInteractor, {