Skip to content

Commit a3d74c0

Browse files
committed
OJ-3609: Move integration tests from jest to vitest
1 parent b235d66 commit a3d74c0

30 files changed

Lines changed: 811 additions & 3740 deletions

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module.exports = {
1717
env: {
1818
node: true,
1919
es2022: true,
20-
jest: true,
2120
},
2221
globals: {
2322
sinon: true,

.github/jest.config.ci.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/run-apigw-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ jobs:
4545
AWS_REGION: ${{ inputs.aws-region }}
4646
with:
4747
working-directory: integration-tests
48-
script: npm run test:api:e2e -- --config jest.config.ci.ts
48+
script: npm run test:api:ci

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ Then run the command:
2222
`AWS_PROFILE=YourProfileName npm run test:api --workspace integration-tests`
2323

2424
This will run all tests in the `api-gateway` directory.
25-
or to run e2e api tests, use the following command
26-
27-
`AWS_PROFILE=YourProfileName npm run test:api:e2e --workspace integration-tests`
2825

2926
Where `YourProfileName` is your aws sso profile, created against the Check Hmrc CRI AWS Account
3027

integration-tests/api-gateway/abandon/abandon-happy.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
12
import { AuditEvent } from "@govuk-one-login/cri-audit";
23
import { pollTestHarnessForEvents } from "@govuk-one-login/cri-test-resources-helpers";
34
import { clearAttemptsTable, clearItemsFromTables, getItemByKey } from "../../resources/dynamodb-helper";
@@ -11,7 +12,7 @@ import {
1112
} from "../endpoints";
1213
import { CLIENT_ID, NINO, REDIRECT_URL } from "../env-variables";
1314

14-
jest.setTimeout(60_000); // 1 min
15+
vi.setConfig({ testTimeout: 60000 });
1516

1617
describe("Given the session is valid and expecting to abandon the journey", () => {
1718
let sessionId: string;

integration-tests/api-gateway/abandon/abandon-unhappy.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
12
import {
23
clearAttemptsTable,
34
clearItemsFromTables,
@@ -11,7 +12,7 @@ import {
1112
} from "../endpoints";
1213
import { CLIENT_ID, NINO, REDIRECT_URL } from "../env-variables";
1314

14-
jest.setTimeout(30_000);
15+
vi.setConfig({ testTimeout: 30000 });
1516

1617
describe("Given the session is invalid and expecting to abandon the journey", () => {
1718
let sessionId: string;

integration-tests/api-gateway/audit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect } from "vitest";
12
import type { UnixSecondsTimestamp } from "@govuk-one-login/cri-types";
23
import { Evidence } from "../../lambdas/common/src/types/evidence";
34
import { AuditEvent, AuditRestricted } from "@govuk-one-login/cri-audit";

integration-tests/api-gateway/authorization/authorization-happy.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
12
import {
23
clearAttemptsTable,
34
clearItemsFromTables,
@@ -11,7 +12,7 @@ import {
1112
} from "../endpoints";
1213
import { CLIENT_ID, NINO, REDIRECT_URL } from "../env-variables";
1314

14-
jest.setTimeout(30_000);
15+
vi.setConfig({ testTimeout: 30000 });
1516

1617
describe("Given the session is valid and expecting to be authorized", () => {
1718
let authCode: { value: string };

integration-tests/api-gateway/authorization/authorization-unhappy.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
12
import {
23
clearAttemptsTable,
34
clearItemsFromTables,
@@ -10,7 +11,7 @@ import {
1011
} from "../endpoints";
1112
import { CLIENT_ID, NINO, REDIRECT_URL } from "../env-variables";
1213

13-
jest.setTimeout(30_000);
14+
vi.setConfig({ testTimeout: 30000 });
1415

1516
describe("Given the session is invalid and expecting it not to be authorized", () => {
1617
let sessionId: string;

integration-tests/api-gateway/check/check-lambda-happy.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
12
import { ninoCheckEndpoint, createSession, getJarAuthorization } from "../endpoints";
23
import { clearAttemptsTable, clearItemsFromTables } from "../../resources/dynamodb-helper";
34
import { AUDIENCE, NINO } from "../env-variables";
@@ -13,7 +14,7 @@ import { testUser } from "../user";
1314
import { AuditEvent } from "@govuk-one-login/cri-audit";
1415
import { pollTestHarnessForEvents } from "@govuk-one-login/cri-test-resources-helpers";
1516

16-
jest.setTimeout(60_000); // 1 min
17+
vi.setConfig({ testTimeout: 60000 });
1718

1819
describe("Given the session and NINO is valid", () => {
1920
let sessionId: string;

0 commit comments

Comments
 (0)