1- import { ZodError } from 'zod' ;
1+ /* eslint-disable @typescript-eslint/no-require-imports */
2+ /* Allow require imports to enable re-import of modules */
23
3- describe ( 'lambdaEnv' , ( ) => {
4+ import { ZodError } from "zod" ;
5+
6+ describe ( "lambdaEnv" , ( ) => {
47 const OLD_ENV = process . env ;
58
69 beforeEach ( ( ) => {
@@ -12,64 +15,64 @@ describe('lambdaEnv', () => {
1215 process . env = OLD_ENV ; // Restore
1316 } ) ;
1417
15- it ( ' should load all environment variables successfully' , ( ) => {
16- process . env . SUPPLIER_ID_HEADER = ' nhsd-supplier-id' ;
17- process . env . APIM_CORRELATION_HEADER = ' nhsd-correlation-id' ;
18- process . env . LETTERS_TABLE_NAME = ' letters-table' ;
19- process . env . MI_TABLE_NAME = ' mi-table' ;
20- process . env . LETTER_TTL_HOURS = ' 12960' ;
21- process . env . MI_TTL_HOURS = ' 2160' ;
22- process . env . DOWNLOAD_URL_TTL_SECONDS = '60' ;
23- process . env . MAX_LIMIT = ' 2500' ;
24- process . env . QUEUE_URL = ' url' ;
18+ it ( " should load all environment variables successfully" , ( ) => {
19+ process . env . SUPPLIER_ID_HEADER = " nhsd-supplier-id" ;
20+ process . env . APIM_CORRELATION_HEADER = " nhsd-correlation-id" ;
21+ process . env . LETTERS_TABLE_NAME = " letters-table" ;
22+ process . env . MI_TABLE_NAME = " mi-table" ;
23+ process . env . LETTER_TTL_HOURS = " 12960" ;
24+ process . env . MI_TTL_HOURS = " 2160" ;
25+ process . env . DOWNLOAD_URL_TTL_SECONDS = "60" ;
26+ process . env . MAX_LIMIT = " 2500" ;
27+ process . env . QUEUE_URL = " url" ;
2528
26- const { envVars } = require ( ' ../env' ) ;
29+ const { envVars } = require ( " ../env" ) ;
2730
2831 expect ( envVars ) . toEqual ( {
29- SUPPLIER_ID_HEADER : ' nhsd-supplier-id' ,
30- APIM_CORRELATION_HEADER : ' nhsd-correlation-id' ,
31- LETTERS_TABLE_NAME : ' letters-table' ,
32- MI_TABLE_NAME : ' mi-table' ,
33- LETTER_TTL_HOURS : 12960 ,
32+ SUPPLIER_ID_HEADER : " nhsd-supplier-id" ,
33+ APIM_CORRELATION_HEADER : " nhsd-correlation-id" ,
34+ LETTERS_TABLE_NAME : " letters-table" ,
35+ MI_TABLE_NAME : " mi-table" ,
36+ LETTER_TTL_HOURS : 12_960 ,
3437 MI_TTL_HOURS : 2160 ,
3538 DOWNLOAD_URL_TTL_SECONDS : 60 ,
3639 MAX_LIMIT : 2500 ,
37- QUEUE_URL : ' url'
40+ QUEUE_URL : " url" ,
3841 } ) ;
3942 } ) ;
4043
41- it ( ' should throw if a required env var is missing' , ( ) => {
42- process . env . SUPPLIER_ID_HEADER = ' nhsd-supplier-id' ;
43- process . env . APIM_CORRELATION_HEADER = ' nhsd-correlation-id' ;
44+ it ( " should throw if a required env var is missing" , ( ) => {
45+ process . env . SUPPLIER_ID_HEADER = " nhsd-supplier-id" ;
46+ process . env . APIM_CORRELATION_HEADER = " nhsd-correlation-id" ;
4447 process . env . LETTERS_TABLE_NAME = undefined ; // simulate missing var
45- process . env . MI_TABLE_NAME = ' mi-table' ;
46- process . env . LETTER_TTL_HOURS = ' 12960' ;
47- process . env . MI_TTL_HOURS = ' 2160' ;
48- process . env . DOWNLOAD_URL_TTL_SECONDS = '60' ;
48+ process . env . MI_TABLE_NAME = " mi-table" ;
49+ process . env . LETTER_TTL_HOURS = " 12960" ;
50+ process . env . MI_TTL_HOURS = " 2160" ;
51+ process . env . DOWNLOAD_URL_TTL_SECONDS = "60" ;
4952
50- expect ( ( ) => require ( ' ../env' ) ) . toThrow ( ZodError ) ;
53+ expect ( ( ) => require ( " ../env" ) ) . toThrow ( ZodError ) ;
5154 } ) ;
5255
53- it ( ' should not throw if optional are not set' , ( ) => {
54- process . env . SUPPLIER_ID_HEADER = ' nhsd-supplier-id' ;
55- process . env . APIM_CORRELATION_HEADER = ' nhsd-correlation-id' ;
56- process . env . LETTERS_TABLE_NAME = ' letters-table' ;
57- process . env . MI_TABLE_NAME = ' mi-table' ;
58- process . env . LETTER_TTL_HOURS = ' 12960' ;
59- process . env . MI_TTL_HOURS = ' 2160' ;
60- process . env . DOWNLOAD_URL_TTL_SECONDS = '60' ;
56+ it ( " should not throw if optional are not set" , ( ) => {
57+ process . env . SUPPLIER_ID_HEADER = " nhsd-supplier-id" ;
58+ process . env . APIM_CORRELATION_HEADER = " nhsd-correlation-id" ;
59+ process . env . LETTERS_TABLE_NAME = " letters-table" ;
60+ process . env . MI_TABLE_NAME = " mi-table" ;
61+ process . env . LETTER_TTL_HOURS = " 12960" ;
62+ process . env . MI_TTL_HOURS = " 2160" ;
63+ process . env . DOWNLOAD_URL_TTL_SECONDS = "60" ;
6164
62- const { envVars } = require ( ' ../env' ) ;
65+ const { envVars } = require ( " ../env" ) ;
6366
6467 expect ( envVars ) . toEqual ( {
65- SUPPLIER_ID_HEADER : ' nhsd-supplier-id' ,
66- APIM_CORRELATION_HEADER : ' nhsd-correlation-id' ,
67- LETTERS_TABLE_NAME : ' letters-table' ,
68- MI_TABLE_NAME : ' mi-table' ,
69- LETTER_TTL_HOURS : 12960 ,
68+ SUPPLIER_ID_HEADER : " nhsd-supplier-id" ,
69+ APIM_CORRELATION_HEADER : " nhsd-correlation-id" ,
70+ LETTERS_TABLE_NAME : " letters-table" ,
71+ MI_TABLE_NAME : " mi-table" ,
72+ LETTER_TTL_HOURS : 12_960 ,
7073 MI_TTL_HOURS : 2160 ,
7174 DOWNLOAD_URL_TTL_SECONDS : 60 ,
72- MAX_LIMIT : undefined
75+ MAX_LIMIT : undefined ,
7376 } ) ;
7477 } ) ;
7578} ) ;
0 commit comments