Fix callback invocations in MediaAPI tests

This commit is contained in:
bjoluc 2021-09-15 12:12:04 +02:00
parent cb65c67935
commit 5ef21c5247

View File

@ -381,8 +381,10 @@ describe("preload plugin", () => {
jest jest
.spyOn(pluginAPI, "preloadImages") .spyOn(pluginAPI, "preloadImages")
.mockImplementation((x, cb_complete, cb_load, cb_error) => { .mockImplementation((x, cb_complete, cb_load, cb_error) => {
cb_load(); if (x.includes("image.png")) {
cb_complete(); cb_load("image.png");
cb_complete();
}
}); });
const { getHTML } = await startTimeline( const { getHTML } = await startTimeline(
@ -623,7 +625,7 @@ describe("preload plugin", () => {
.spyOn(pluginAPI, "preloadImages") .spyOn(pluginAPI, "preloadImages")
.mockImplementation((x, cb_complete, cb_load, cb_error) => { .mockImplementation((x, cb_complete, cb_load, cb_error) => {
if (x.includes("blue.png")) { if (x.includes("blue.png")) {
cb_load(); cb_load("blue.png");
cb_complete(); cb_complete();
} else { } else {
cb_error({ cb_error({
@ -734,7 +736,7 @@ describe("preload plugin", () => {
.spyOn(pluginAPI, "preloadImages") .spyOn(pluginAPI, "preloadImages")
.mockImplementation((x, cb_complete, cb_load, cb_error) => { .mockImplementation((x, cb_complete, cb_load, cb_error) => {
if (x.includes("blue.png")) { if (x.includes("blue.png")) {
cb_load(); cb_load("blue.png");
cb_complete(); cb_complete();
} }
}); });