feature/IO-2769-Job-Totals-testing: Allow for both american and canadian capture + tests
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { TotalsServerSide } from "../job-totals";
|
||||
import { TotalsServerSide as TotalsServerSideCA } from "../job-totals"; // Canadian version (imex)
|
||||
import { TotalsServerSide as TotalsServerSideUS } from "../job-totals-USA"; // US version (rome)
|
||||
|
||||
/**
|
||||
* This function is used to replace the values in the object with their
|
||||
@@ -48,7 +49,7 @@ describe("TotalsServerSide fixture tests", () => {
|
||||
const fixturePath = path.join(fixturesDir, file);
|
||||
const fixtureData = JSON.parse(fs.readFileSync(fixturePath, "utf8"));
|
||||
|
||||
const { input, output: expectedOutput } = fixtureData;
|
||||
const { environment, input, output: expectedOutput } = fixtureData;
|
||||
|
||||
const req = {
|
||||
body: {
|
||||
@@ -58,7 +59,8 @@ describe("TotalsServerSide fixture tests", () => {
|
||||
user: {}
|
||||
};
|
||||
|
||||
const computedOutput = await TotalsServerSide(req, dummyRes);
|
||||
const computedOutput =
|
||||
environment === "us" ? await TotalsServerSideUS(req, dummyRes) : await TotalsServerSideCA(req, dummyRes);
|
||||
|
||||
const normalizedComputed = normalizeOutput(computedOutput);
|
||||
const normalizedExpected = normalizeOutput(expectedOutput);
|
||||
|
||||
Reference in New Issue
Block a user