Skip to content

Commit 7faa170

Browse files
refactor: make sure tests work with latest additions to service-API
1 parent ffd537d commit 7faa170

File tree

7 files changed

+44
-13
lines changed

7 files changed

+44
-13
lines changed

tests/classic/src/view/mail/inbox/InboxViewTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333
t.requireOk(
3434
"conjoon.cn_mail.store.mail.folder.MailFolderTreeStore", () => {

tests/lib/mail/TestHelper.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -177,6 +177,37 @@ export default class TestHelper {
177177
}
178178

179179

180+
/**
181+
* Creates stubs for services.
182+
*
183+
* @param {String] className The name of the service that should be considered
184+
* for stubbing
185+
*/
186+
async mockUpServices (className) {
187+
188+
const t = this.siestaTest;
189+
190+
await new Promise(function (resolve, reject) {
191+
192+
t.requireOk(
193+
className,
194+
"coon.core.ServiceProvider",
195+
function () {
196+
coon.core.ServiceProvider.get = function (key) {
197+
return key === "coon.core.service.UserImageService" ? {
198+
199+
getImageSrc: () => {}
200+
201+
} : undefined;
202+
};
203+
resolve("-> services");
204+
});
205+
});
206+
207+
return this;
208+
}
209+
210+
180211
/**
181212
* Send out the spies!
182213
*/

tests/src/view/mail/MailDesktopViewControllerTest_0.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333
const discardView = t => {
3434

tests/src/view/mail/MailDesktopViewControllerTest_1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333

3434
const getChildAt = function (panel, rootId, index, shouldBe, t) {

tests/src/view/mail/MailDesktopViewControllerTest_2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333
const getChildAt = function (panel, rootId, index, shouldBe, t) {
3434

tests/src/view/mail/MailDesktopViewControllerTest_3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333
const selectMailFolder = function (panel, storeAt, shouldBeId, t) {
3434

tests/src/view/mail/inbox/InboxViewControllerTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* conjoon
33
* extjs-app-webmail
4-
* Copyright (C) 2017-2021 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
4+
* Copyright (C) 2017-2022 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
55
*
66
* Permission is hereby granted, free of charge, to any person
77
* obtaining a copy of this software and associated documentation
@@ -28,7 +28,7 @@ import TestHelper from "/tests/lib/mail/TestHelper.js";
2828
StartTest(async t => {
2929

3030
const helper = l8.liquify(TestHelper.get(t, window));
31-
await helper.setupSimlets().mockUpMailTemplates().andRun((t) => {
31+
await helper.setupSimlets().mockUpMailTemplates().mockUpServices("coon.core.service.UserImageService").andRun((t) => {
3232

3333

3434
var panel;

0 commit comments

Comments
 (0)