Skip to content

Commit 252b33e

Browse files
Upgrade: [dependabot] - bump vitest from 3.2.4 to 4.1.2 (#2959)
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 3.2.4 to 4.1.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/vitest-dev/vitest/releases">vitest's releases</a>.</em></p> <blockquote> <h2>v4.1.2</h2> <p>This release bumps Vitest's <code>flatted</code> version and removes version pinning to resolve <code>flatted</code>'s CVE related issues (<a href="https://redirect.github.com/vitest-dev/vitest/issues/9975">vitest-dev/vitest#9975</a>).</p> <h3>   🐞 Bug Fixes</h3> <ul> <li>Don't resolve <code>setupFiles</code> from parent directory  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9960">vitest-dev/vitest#9960</a> <a href="https://github.com/vitest-dev/vitest/commit/7aa937776"><!-- raw HTML omitted -->(7aa93)<!-- raw HTML omitted --></a></li> <li>Ensure sequential mock/unmock resolution  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> and <strong>Claude Opus 4.6</strong> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9830">vitest-dev/vitest#9830</a> <a href="https://github.com/vitest-dev/vitest/commit/7c06598db"><!-- raw HTML omitted -->(7c065)<!-- raw HTML omitted --></a></li> <li><strong>browser</strong>: Take failure screenshot if <code>toMatchScreenshot</code> can't capture a stable screenshot  -  by <a href="https://github.com/macarie"><code>@​macarie</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9847">vitest-dev/vitest#9847</a> <a href="https://github.com/vitest-dev/vitest/commit/faace1fbe"><!-- raw HTML omitted -->(faace)<!-- raw HTML omitted --></a></li> <li><strong>coverage</strong>: Correct <code>coverageConfigDefaults</code> values and types  -  by <a href="https://github.com/Arthie"><code>@​Arthie</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9940">vitest-dev/vitest#9940</a> <a href="https://github.com/vitest-dev/vitest/commit/b3c992cb2"><!-- raw HTML omitted -->(b3c99)<!-- raw HTML omitted --></a></li> <li><strong>pretty-format</strong>: Fix output limit over counting  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9965">vitest-dev/vitest#9965</a> <a href="https://github.com/vitest-dev/vitest/commit/d3b7a40fa"><!-- raw HTML omitted -->(d3b7a)<!-- raw HTML omitted --></a></li> <li>Disable colors if agent is detected  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> and <a href="https://github.com/AriPerkkio"><code>@​AriPerkkio</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9851">vitest-dev/vitest#9851</a> <a href="https://github.com/vitest-dev/vitest/commit/6f97b55dd"><!-- raw HTML omitted -->(6f97b)<!-- raw HTML omitted --></a></li> </ul> <h5>    <a href="https://github.com/vitest-dev/vitest/compare/v4.1.1...v4.1.2">View changes on GitHub</a></h5> <h2>v4.1.1</h2> <h3>   🚀 Features</h3> <ul> <li><strong>experimental</strong>: <ul> <li>Expose <code>matchesTags</code> to test if the current filter matches tags  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9913">vitest-dev/vitest#9913</a> <a href="https://github.com/vitest-dev/vitest/commit/eec53d9f5"><!-- raw HTML omitted -->(eec53)<!-- raw HTML omitted --></a></li> <li>Introduce <code>experimental.vcsProvider</code>  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9928">vitest-dev/vitest#9928</a> <a href="https://github.com/vitest-dev/vitest/commit/561150036"><!-- raw HTML omitted -->(56115)<!-- raw HTML omitted --></a></li> </ul> </li> </ul> <h3>   🐞 Bug Fixes</h3> <ul> <li>Mark <code>TestProject.testFilesList</code> internal properly  -  by <a href="https://github.com/sapphi-red"><code>@​sapphi-red</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9867">vitest-dev/vitest#9867</a> <a href="https://github.com/vitest-dev/vitest/commit/54f2660f5"><!-- raw HTML omitted -->(54f26)<!-- raw HTML omitted --></a></li> <li>Detect fixture that returns without calling <code>use</code>  -  by <a href="https://github.com/oilater"><code>@​oilater</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9831">vitest-dev/vitest#9831</a> and <a href="https://redirect.github.com/vitest-dev/vitest/issues/9861">vitest-dev/vitest#9861</a> <a href="https://github.com/vitest-dev/vitest/commit/633ae2303"><!-- raw HTML omitted -->(633ae)<!-- raw HTML omitted --></a></li> <li>Drop vite 8.beta support  -  by <a href="https://github.com/AriPerkkio"><code>@​AriPerkkio</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9862">vitest-dev/vitest#9862</a> <a href="https://github.com/vitest-dev/vitest/commit/b78f5389d"><!-- raw HTML omitted -->(b78f5)<!-- raw HTML omitted --></a></li> <li>Type regression in vi.mocked() static class methods  -  by <a href="https://github.com/purepear"><code>@​purepear</code></a> and <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9857">vitest-dev/vitest#9857</a> <a href="https://github.com/vitest-dev/vitest/commit/90926641b"><!-- raw HTML omitted -->(90926)<!-- raw HTML omitted --></a></li> <li>Properly re-evaluate actual modules of mocked external  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9898">vitest-dev/vitest#9898</a> <a href="https://github.com/vitest-dev/vitest/commit/ae5ec03ef"><!-- raw HTML omitted -->(ae5ec)<!-- raw HTML omitted --></a></li> <li>Preserve coverage report when html reporter overlaps  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9889">vitest-dev/vitest#9889</a> <a href="https://github.com/vitest-dev/vitest/commit/2d81ad897"><!-- raw HTML omitted -->(2d81a)<!-- raw HTML omitted --></a></li> <li>Provide <code>vi.advanceTimers</code> to the preview provider  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9891">vitest-dev/vitest#9891</a> <a href="https://github.com/vitest-dev/vitest/commit/1bc3e63be"><!-- raw HTML omitted -->(1bc3e)<!-- raw HTML omitted --></a></li> <li>Don't leak event listener in playwright provider  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9910">vitest-dev/vitest#9910</a> <a href="https://github.com/vitest-dev/vitest/commit/d93550ff7"><!-- raw HTML omitted -->(d9355)<!-- raw HTML omitted --></a></li> <li>Open browser in <code>--standalone</code> mode without running tests  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9911">vitest-dev/vitest#9911</a> <a href="https://github.com/vitest-dev/vitest/commit/e78adcf97"><!-- raw HTML omitted -->(e78ad)<!-- raw HTML omitted --></a></li> <li>Guard disposable and optional <code>body</code>  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9912">vitest-dev/vitest#9912</a> <a href="https://github.com/vitest-dev/vitest/commit/6fdb2ba61"><!-- raw HTML omitted -->(6fdb2)<!-- raw HTML omitted --></a></li> <li>Resolve <code>retry.condition</code> RegExp serialization issue  -  by <a href="https://github.com/nstepien"><code>@​nstepien</code></a> and <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9942">vitest-dev/vitest#9942</a> <a href="https://github.com/vitest-dev/vitest/commit/7b6054328"><!-- raw HTML omitted -->(7b605)<!-- raw HTML omitted --></a></li> <li><strong>collect</strong>: <ul> <li>Don't treat extra props on <code>test</code> return as tests  -  by <a href="https://github.com/sheremet-va"><code>@​sheremet-va</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9871">vitest-dev/vitest#9871</a> <a href="https://github.com/vitest-dev/vitest/commit/141e72aa1"><!-- raw HTML omitted -->(141e7)<!-- raw HTML omitted --></a></li> </ul> </li> <li><strong>coverage</strong>: <ul> <li>Simplify provider types  -  by <a href="https://github.com/AriPerkkio"><code>@​AriPerkkio</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9931">vitest-dev/vitest#9931</a> <a href="https://github.com/vitest-dev/vitest/commit/aaf9f18ae"><!-- raw HTML omitted -->(aaf9f)<!-- raw HTML omitted --></a></li> <li>Load built-in provider without module runner  -  by <a href="https://github.com/AriPerkkio"><code>@​AriPerkkio</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9939">vitest-dev/vitest#9939</a> <a href="https://github.com/vitest-dev/vitest/commit/bf8920817"><!-- raw HTML omitted -->(bf892)<!-- raw HTML omitted --></a></li> </ul> </li> <li><strong>expect</strong>: <ul> <li>Soft assertions continue after .resolves/.rejects promise errors  -  by <a href="https://github.com/mixelburg"><code>@​mixelburg</code></a>, <strong>Maks Pikov</strong>, <strong>Claude Opus 4.6 (1M context)</strong> and <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9843">vitest-dev/vitest#9843</a> <a href="https://github.com/vitest-dev/vitest/commit/6d74b4948"><!-- raw HTML omitted -->(6d74b)<!-- raw HTML omitted --></a></li> <li>Fix sinon-chai style API  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9943">vitest-dev/vitest#9943</a> <a href="https://github.com/vitest-dev/vitest/commit/0f08dda2c"><!-- raw HTML omitted -->(0f08d)<!-- raw HTML omitted --></a></li> </ul> </li> <li><strong>pretty-format</strong>: <ul> <li>Limit output for large object  -  by <a href="https://github.com/hi-ogawa"><code>@​hi-ogawa</code></a> and <strong>Claude Opus 4.6 (1M context)</strong> in <a href="https://redirect.github.com/vitest-dev/vitest/issues/9949">vitest-dev/vitest#9949</a> <a href="https://github.com/vitest-dev/vitest/commit/0d5f9d6ef"><!-- raw HTML omitted -->(0d5f9)<!-- raw HTML omitted --></a></li> </ul> </li> </ul> <h5>    <a href="https://github.com/vitest-dev/vitest/compare/v4.1.0...v4.1.1">View changes on GitHub</a></h5> <h2>v4.1.0</h2> <p>Vitest 4.1 is out!</p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/vitest-dev/vitest/commit/fc6f482f4c54bf6a766a0ff502b9843994af5bf5"><code>fc6f482</code></a> chore: release v4.1.2</li> <li><a href="https://github.com/vitest-dev/vitest/commit/6f97b55ddc446e725d259b7790eb21e39be77d6c"><code>6f97b55</code></a> feat: disable colors if agent is detected (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9851">#9851</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/b3c992cb29ede4cca1581ed08dd9921d575cb384"><code>b3c992c</code></a> fix(coverage): correct <code>coverageConfigDefaults</code> values and types (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9940">#9940</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/7c06598dbb49d9b54c990d537b700474330b6e12"><code>7c06598</code></a> fix: ensure sequential mock/unmock resolution (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9830">#9830</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/f54abad136c25796937f2376a3c8c1c10f5c71c8"><code>f54abad</code></a> chore: add typo-checker skill and fix typos (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9963">#9963</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/7aa93777641fb78643535cf46b1d080910ec97c8"><code>7aa9377</code></a> fix: don't resolve <code>setupFiles</code> from parent directory (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9960">#9960</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/1f2d318493363855b66a22caaf7c1c10579029d5"><code>1f2d318</code></a> chore: release v4.1.1</li> <li><a href="https://github.com/vitest-dev/vitest/commit/ebfde798fbaeeb1fc7542d734dff216f39272201"><code>ebfde79</code></a> refactor: rename <code>matchesTagsFilter</code> to <code>matchesTags</code> (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9956">#9956</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/561150036f5784039020b1c1e767e78e1088e16c"><code>5611500</code></a> feat(experimental): introduce <code>experimental.vcsProvider</code> (<a href="https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest/issues/9928">#9928</a>)</li> <li><a href="https://github.com/vitest-dev/vitest/commit/eec53d9f592717ebb6febec517bbc1d1f2af250a"><code>eec53d9</code></a> feat(experimental): expose <code>matchesTagsFilter</code> to test if the current filter ...</li> <li>Additional commits viewable in <a href="https://github.com/vitest-dev/vitest/commits/v4.1.2/packages/vitest">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by [GitHub Actions](<a href="https://www.npmjs.com/~GitHub">https://www.npmjs.com/~GitHub</a> Actions), a new releaser for vitest since your current version.</p> </details> <br /> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: tstephen-nhs <231503406+tstephen-nhs@users.noreply.github.com>
1 parent 3a26603 commit 252b33e

14 files changed

Lines changed: 2736 additions & 2625 deletions

package-lock.json

Lines changed: 2650 additions & 2562 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@eslint/js": "^10.0.1",
3636
"@types/aws-lambda": "^8.10.161",
3737
"@types/node": "^25.5.2",
38-
"@vitest/coverage-v8": "^3.2.4",
38+
"@vitest/coverage-v8": "^4.1.2",
3939
"@typescript-eslint/eslint-plugin": "^8.57.2",
4040
"@typescript-eslint/parser": "^8.57.1",
4141
"aws-lambda": "^1.0.7",
@@ -46,7 +46,7 @@
4646
"globals": "^17.4.0",
4747
"ts-node": "^10.9.2",
4848
"vite-tsconfig-paths": "^6.1.1",
49-
"vitest": "^3.2.4",
49+
"vitest": "^4.1.2",
5050
"typescript": "^6.0.2",
5151
"typescript-eslint": "^8.57.2"
5252
},

packages/cpsuLambda/src/handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {APIGatewayProxyResult} from "aws-lambda"
22
import middy from "@middy/core"
3-
import {MiddlewareGenerator} from "./middleware"
3+
import {MiddlewareApplicator} from "./middleware"
44
import {Logger} from "@aws-lambda-powertools/logger"
55
import {Result} from "pratica"
66
import {Bundle, Task} from "fhir/r4"
@@ -18,7 +18,7 @@ type EventWithHeaders = {
1818
}
1919
}
2020
type HandlerConfig<Event, Message> = {
21-
middleware: Array<MiddlewareGenerator>
21+
middleware: Array<MiddlewareApplicator>
2222
params: HandlerParams<Event, Message>
2323
logger: Logger
2424
schema?: object
@@ -70,10 +70,10 @@ function append_headers(headers: Record<string, string>, logger: Logger) {
7070
* Creates a new Lambda handler with the specified handler function and middleware.
7171
*/
7272
export const newHandler = <Event extends EventWithHeaders, Message>(handlerConfig: HandlerConfig<Event, Message>) => {
73-
const newHandler = middy((event: Event) => generic_handler(event, handlerConfig.params, handlerConfig.logger))
73+
let newHandler = middy((event: Event) => generic_handler(event, handlerConfig.params, handlerConfig.logger))
7474

75-
for (const middleware_generator of handlerConfig.middleware) {
76-
newHandler.use(middleware_generator(handlerConfig.logger, handlerConfig.schema))
75+
for (const middleware_applicator of handlerConfig.middleware) {
76+
newHandler = middleware_applicator(newHandler, handlerConfig.logger, handlerConfig.schema)
7777
}
7878

7979
return newHandler

packages/cpsuLambda/src/middleware.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
import inputOutputLogger from "@middy/input-output-logger"
22
import httpHeaderNormalizer from "@middy/http-header-normalizer"
33
import {injectLambdaContext} from "@aws-lambda-powertools/logger/middleware"
4-
import middy from "@middy/core"
4+
import {MiddyfiedHandler} from "@middy/core"
5+
import {APIGatewayProxyResult} from "aws-lambda"
56
import {Logger} from "@aws-lambda-powertools/logger"
67
import validator from "@middy/validator"
78
import {transpileSchema} from "@middy/validator/transpile"
89
import {validationErrorHandler} from "./errorHandler"
910

10-
export type MiddlewareGenerator = (logger: Logger, schema?: object) => middy.MiddlewareObj
11+
export type MiddlewareApplicator = <Event>(
12+
handler: MiddyfiedHandler<Event, APIGatewayProxyResult>,
13+
logger: Logger,
14+
schema?: object
15+
) => MiddyfiedHandler<Event, APIGatewayProxyResult>
1116

12-
export const MIDDLEWARE: Record<string, MiddlewareGenerator> = {
13-
injectLambdaContext: (logger) => injectLambdaContext(logger, {clearState: true}),
14-
httpHeaderNormalizer: () => httpHeaderNormalizer() as middy.MiddlewareObj,
15-
inputOutputLogger: (logger) =>
16-
inputOutputLogger({
17+
export const MIDDLEWARE: Record<string, MiddlewareApplicator> = {
18+
injectLambdaContext: (handler, logger) =>
19+
handler.use(injectLambdaContext(logger, {clearState: true})),
20+
httpHeaderNormalizer: (handler) =>
21+
handler.use(httpHeaderNormalizer()),
22+
inputOutputLogger: (handler, logger) =>
23+
handler.use(inputOutputLogger({
1724
logger: (request) => {
1825
const response = (request as {response?: unknown} | null | undefined)?.response
1926
if (response === undefined) {
@@ -22,9 +29,11 @@ export const MIDDLEWARE: Record<string, MiddlewareGenerator> = {
2229
logger.debug("inputOutputLogger response", {response})
2330
}
2431
}
25-
}),
26-
validator: (logger, schema) => validator({eventSchema: transpileSchema(schema as object)}),
27-
validationErrorHandler: (logger) => validationErrorHandler({logger: logger})
32+
})),
33+
validator: (handler, logger, schema) =>
34+
handler.use(validator({eventSchema: transpileSchema(schema as object)})),
35+
validationErrorHandler: (handler, logger) =>
36+
handler.use(validationErrorHandler({logger: logger}))
2837
}
2938

3039
export const DEFAULT_HANDLER_MIDDLEWARE = [

packages/nhsNotifyLambda/tests/testAuth.test.ts

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ describe("tokenExchange", () => {
6868
},
6969
sign: vi.fn().mockImplementation(() => Promise.resolve("signed.jwt.token"))
7070
}
71-
mockSignJWTConstructor.mockImplementation(() => fakeJwtInstance)
71+
mockSignJWTConstructor.mockImplementation(function() {
72+
return fakeJwtInstance
73+
})
7274

7375
// Mock the HTTP call
7476
nock(`${host}`)
@@ -101,18 +103,20 @@ describe("tokenExchange", () => {
101103
}
102104

103105
mockImportPKCS8.mockImplementation(() => Promise.resolve("imported"))
104-
mockSignJWTConstructor.mockImplementation(() => ({
105-
setProtectedHeader() {
106-
return this
107-
},
108-
setIssuedAt() {
109-
return this
110-
},
111-
setExpirationTime() {
112-
return this
113-
},
114-
sign: vi.fn().mockImplementation(() => Promise.resolve("jwt-tkn"))
115-
}))
106+
mockSignJWTConstructor.mockImplementation(function() {
107+
return ({
108+
setProtectedHeader() {
109+
return this
110+
},
111+
setIssuedAt() {
112+
return this
113+
},
114+
setExpirationTime() {
115+
return this
116+
},
117+
sign: vi.fn().mockImplementation(() => Promise.resolve("jwt-tkn"))
118+
})
119+
})
116120

117121
nock(`${host}`)
118122
.post("/oauth2/token")
@@ -131,18 +135,20 @@ describe("tokenExchange", () => {
131135
}
132136

133137
mockImportPKCS8.mockImplementation(() => Promise.resolve("imported"))
134-
mockSignJWTConstructor.mockImplementation(() => ({
135-
setProtectedHeader() {
136-
return this
137-
},
138-
setIssuedAt() {
139-
return this
140-
},
141-
setExpirationTime() {
142-
return this
143-
},
144-
sign: vi.fn().mockImplementation(() => Promise.resolve("jwt-tkn"))
145-
}))
138+
mockSignJWTConstructor.mockImplementation(function() {
139+
return ({
140+
setProtectedHeader() {
141+
return this
142+
},
143+
setIssuedAt() {
144+
return this
145+
},
146+
setExpirationTime() {
147+
return this
148+
},
149+
sign: vi.fn().mockImplementation(() => Promise.resolve("jwt-tkn"))
150+
})
151+
})
146152

147153
nock(`${host}`)
148154
.post("/oauth2/token")

packages/nhsNotifyLambda/tests/testHelpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ vi.mock("@aws-sdk/client-sqs", async (importOriginal) => {
1010
const sqs = await importOriginal<typeof import("@aws-sdk/client-sqs")>()
1111
return {
1212
...sqs,
13-
SQSClient: vi.fn().mockImplementation(() => ({
14-
send: mockSend
15-
}))
13+
SQSClient: vi.fn(class {
14+
send = mockSend
15+
})
1616
}
1717
})
1818

packages/nhsNotifyLambda/tests/testNhsNotifyLambda.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ vi.mock(
5959
"@aws-lambda-powertools/logger",
6060
async () => ({
6161
__esModule: true,
62-
Logger: vi.fn().mockImplementation(() => ({
63-
info: mockInfo,
64-
error: mockError,
65-
warn: mockWarn
66-
}))
62+
Logger: vi.fn(class {
63+
info = mockInfo
64+
error = mockError
65+
warn = mockWarn
66+
})
6767
})
6868
)
6969

packages/nhsNotifyLambda/tests/testUtils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ vi.mock(
4242
"@aws-lambda-powertools/parameters/ssm",
4343
async () => ({
4444
__esModule: true,
45-
SSMProvider: vi.fn().mockImplementation(() => ({
46-
getParametersByName: mockGetParametersByName
47-
}))
45+
SSMProvider: vi.fn(class {
46+
getParametersByName = mockGetParametersByName
47+
})
4848
})
4949
)
5050

packages/postDatedLambda/tests/testDatabaseClient.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ vi.mock("@aws-sdk/client-dynamodb", async () => {
1818
const dynamo = await vi.importActual<typeof import("@aws-sdk/client-dynamodb")>("@aws-sdk/client-dynamodb")
1919
return {
2020
...dynamo,
21-
DynamoDBClient: vi.fn().mockImplementation(() => ({
22-
send: mockSend
23-
}))
21+
DynamoDBClient: vi.fn(class {
22+
send = mockSend
23+
})
2424
}
2525
})
2626
const {

packages/postDatedLambda/tests/testSqs.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ vi.mock("@aws-sdk/client-sqs", async () => {
2020
const sqs = await vi.importActual<typeof import("@aws-sdk/client-sqs")>("@aws-sdk/client-sqs")
2121
return {
2222
...sqs,
23-
SQSClient: vi.fn().mockImplementation(() => ({
24-
send: mockSend
25-
}))
23+
SQSClient: vi.fn(class {
24+
send = mockSend
25+
})
2626
}
2727
})
2828

0 commit comments

Comments
 (0)