Skip to content

Commit

Permalink
fix: use vi.importActual
Browse files Browse the repository at this point in the history
  • Loading branch information
TextC0de committed Sep 18, 2024
1 parent 0d75941 commit 3e872bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions workers/purchase_order_payment_sync_cron/scheduled.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ vi.mock("~/datasources/db");

type MercadoPagoModule = typeof import("~/datasources/mercadopago");

vi.mock(import("~/datasources/mercadopago"), async (importOriginal) => {
const mod = await importOriginal<MercadoPagoModule>();
vi.mock("~/datasources/mercadopago", async () => {
const actual = await vi.importActual<MercadoPagoModule>(
"~/datasources/mercadopago",
);

return {
...mod,
...actual,
getMercadoPagoPayment: vi.fn(),
};
});

type StripeModule = typeof import("~/datasources/stripe");

vi.mock(import("~/datasources/stripe"), async (importOriginal) => {
const actual = await importOriginal<StripeModule>();
vi.mock("~/datasources/stripe", async () => {
const actual = await vi.importActual<StripeModule>("~/datasources/stripe");

return {
...actual,
Expand Down

0 comments on commit 3e872bd

Please sign in to comment.