test: preload mocked modules

This commit is contained in:
2024-06-15 06:24:29 -04:00
parent d39165c8f6
commit dfd709ad1c
5 changed files with 30 additions and 37 deletions

View File

@@ -1,2 +1,2 @@
[test]
preload = ["./testSetup.ts"]
preload = ["./testSetup.ts", "./src/mocks/consumet.ts", "./src/mocks/gToken.ts"]

View File

@@ -2,10 +2,8 @@ import { describe, expect, it } from "bun:test";
import app from "~/index";
import { server } from "~/mocks";
import { mockConsumet } from "~/mocks/consumet";
server.listen();
mockConsumet();
describe('requests the "/episodes" route', () => {
it("with list of episodes from Anify", async () => {

View File

@@ -2,10 +2,8 @@ import { describe, expect, it } from "bun:test";
import app from "~/index";
import { server } from "~/mocks";
import { mockConsumet } from "~/mocks/consumet";
server.listen();
mockConsumet();
describe('requests the "/episodes/:id/url" route', () => {
it("with sources from Anify", async () => {

View File

@@ -1,7 +1,6 @@
import { describe, expect, it } from "bun:test";
import { server } from "~/mocks";
import "~/mocks/gToken";
import { verifyFcmToken } from "./verifyFcmToken";

View File

@@ -2,7 +2,6 @@ import type { IAnimeEpisode, ISource } from "@consumet/extensions";
import { mock } from "bun:test";
export function mockConsumet() {
mock.module("src/consumet", () => ({
aniList: {
fetchEpisodesListById(
@@ -34,4 +33,3 @@ export function mockConsumet() {
},
},
}));
}