feature/IO-3587-Commision-Cut - restore test fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const sendPaymentNotificationEmail = require("./sendPaymentNotificationEmail");
|
const sendPaymentNotificationEmail = require("./sendPaymentNotificationEmail");
|
||||||
const { INSERT_NEW_PAYMENT, GET_BODYSHOP_BY_ID, GET_JOBS_BY_PKS } = require("../../graphql-client/queries");
|
const { INSERT_NEW_PAYMENT, GET_BODYSHOP_BY_ID, GET_JOBS_BY_PKS } = require("../../graphql-client/queries");
|
||||||
const getPaymentType = require("./getPaymentType");
|
const getPaymentType = require("./getPaymentType");
|
||||||
const moment = require("moment");
|
const moment = require("moment-timezone");
|
||||||
|
|
||||||
const gqlClient = require("../../graphql-client/graphql-client").client;
|
const gqlClient = require("../../graphql-client/graphql-client").client;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const {
|
|||||||
|
|
||||||
const { sendTaskEmail } = require("../../email/sendemail");
|
const { sendTaskEmail } = require("../../email/sendemail");
|
||||||
const getPaymentType = require("./getPaymentType");
|
const getPaymentType = require("./getPaymentType");
|
||||||
const moment = require("moment");
|
const moment = require("moment-timezone");
|
||||||
|
|
||||||
const gqlClient = require("../../graphql-client/graphql-client").client;
|
const gqlClient = require("../../graphql-client/graphql-client").client;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||||
|
|
||||||
|
const { mockSend } = vi.hoisted(() => ({
|
||||||
|
mockSend: vi.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
|
vi.mock("@aws-sdk/client-secrets-manager", () => {
|
||||||
|
return {
|
||||||
|
SecretsManagerClient: vi.fn(() => ({
|
||||||
|
send: mockSend
|
||||||
|
})),
|
||||||
|
GetSecretValueCommand: vi.fn((input) => input)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const getPaymentType = require("../getPaymentType");
|
const getPaymentType = require("../getPaymentType");
|
||||||
const decodeComment = require("../decodeComment");
|
const decodeComment = require("../decodeComment");
|
||||||
const getCptellerUrl = require("../getCptellerUrl");
|
const getCptellerUrl = require("../getCptellerUrl");
|
||||||
@@ -145,28 +158,15 @@ describe("Payment Processing Functions", () => {
|
|||||||
// GetShopCredentials Tests
|
// GetShopCredentials Tests
|
||||||
describe("getShopCredentials", () => {
|
describe("getShopCredentials", () => {
|
||||||
const originalEnv = { ...process.env };
|
const originalEnv = { ...process.env };
|
||||||
let mockSend;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockSend = vi.fn();
|
mockSend.mockReset();
|
||||||
vi.mock("@aws-sdk/client-secrets-manager", () => {
|
|
||||||
return {
|
|
||||||
SecretsManagerClient: vi.fn(() => ({
|
|
||||||
send: mockSend
|
|
||||||
})),
|
|
||||||
GetSecretValueCommand: vi.fn((input) => input)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
process.env.INTELLIPAY_MERCHANTKEY = "test-merchant-key";
|
process.env.INTELLIPAY_MERCHANTKEY = "test-merchant-key";
|
||||||
process.env.INTELLIPAY_APIKEY = "test-api-key";
|
process.env.INTELLIPAY_APIKEY = "test-api-key";
|
||||||
vi.resetModules();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
process.env = { ...originalEnv };
|
process.env = { ...originalEnv };
|
||||||
vi.restoreAllMocks();
|
|
||||||
vi.unmock("@aws-sdk/client-secrets-manager");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns environment variables in non-production environment", async () => {
|
it("returns environment variables in non-production environment", async () => {
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ describe("TotalsServerSide fixture tests", () => {
|
|||||||
|
|
||||||
const fixtureFiles = fs.readdirSync(fixturesDir).filter((f) => f.endsWith(".json"));
|
const fixtureFiles = fs.readdirSync(fixturesDir).filter((f) => f.endsWith(".json"));
|
||||||
|
|
||||||
|
if (fixtureFiles.length === 0) {
|
||||||
|
it.skip("skips when no job total fixtures are present", () => {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const dummyClient = {
|
const dummyClient = {
|
||||||
request: async () => {
|
request: async () => {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Reference in New Issue
Block a user