|
1 | 1 | import { afterAll, expect, test, beforeEach, vi } from "vitest"; |
2 | | -import { SendRawEmailCommand, SESClient } from "@aws-sdk/client-ses"; |
3 | | -import { mockClient } from "aws-sdk-client-mock"; |
4 | 2 | import { secretObject } from "./secret.testdata.js"; |
5 | 3 | import init from "../../src/api/index.js"; |
6 | 4 | import { describe } from "node:test"; |
7 | 5 | import { EntraFetchError } from "../../src/common/errors/index.js"; |
8 | | - |
9 | | -const sesMock = mockClient(SESClient); |
10 | | -const jwt_secret = secretObject["jwt_key"]; |
11 | | -vi.stubEnv("JwtSigningKey", jwt_secret); |
| 6 | +import { issueAppleWalletMembershipCard } from "../../src/api/functions/mobileWallet.js"; |
12 | 7 |
|
13 | 8 | vi.mock("../../src/api/functions/membership.js", () => { |
14 | 9 | return { |
@@ -72,21 +67,12 @@ describe("Mobile wallet pass issuance", async () => { |
72 | 67 | await response.json(); |
73 | 68 | }); |
74 | 69 | test("Test that passes will be issued for members", async () => { |
75 | | - sesMock.on(SendRawEmailCommand).resolves({}); |
76 | 70 | const response = await app.inject({ |
77 | 71 | method: "GET", |
78 | 72 | url: "/api/v1/mobileWallet/[email protected]", |
79 | 73 | }); |
80 | 74 | expect(response.statusCode).toBe(202); |
81 | | - expect(); |
82 | | - }); |
83 | | - test("Test that SES errors result in a server error", async () => { |
84 | | - sesMock.on(SendRawEmailCommand).rejects({}); |
85 | | - const response = await app.inject({ |
86 | | - method: "GET", |
87 | | - url: "/api/v1/mobileWallet/[email protected]", |
88 | | - }); |
89 | | - expect(response.statusCode).toBe(500); |
| 75 | + expect(issueAppleWalletMembershipCard).toHaveBeenCalledOnce(); |
90 | 76 | }); |
91 | 77 | afterAll(async () => { |
92 | 78 | await app.close(); |
|
0 commit comments