11import { runHealthChecks } from "@libs/healthCheck" ;
22import { DummyLogWriter } from "@libs/logWriter" ;
3- import { CONFIG_VARS , getConfigValue } from "@libs/ssmUtils" ;
43import axios from "axios" ;
54
65jest . mock ( "axios" ) ;
@@ -10,18 +9,9 @@ jest.mock("@libs/ssmUtils", () => ({
109 getConfigValue : jest . fn ( ) ,
1110} ) ) ;
1211
13- const mockGetConfigValue = getConfigValue as jest . MockedFunction < typeof getConfigValue > ;
14-
1512describe ( "healthCheck" , ( ) => {
1613 const logger = DummyLogWriter ;
1714
18- beforeEach ( ( ) => {
19- mockGetConfigValue . mockImplementation ( async ( paramName : CONFIG_VARS ) => {
20- if ( paramName === "FEATURE_CIGARETTE_LICENSE" ) return "true" ;
21- return "false" ;
22- } ) ;
23- } ) ;
24-
2515 it ( "returns an object with pass statuses if success is true" , async ( ) => {
2616 mockAxios . get . mockResolvedValue ( { data : { success : true } } ) ;
2717 expect ( await runHealthChecks ( logger ) ) . toStrictEqual ( {
@@ -34,8 +24,6 @@ describe("healthCheck", () => {
3424 webserviceFormation : "PASS" ,
3525 taxClearance : "PASS" ,
3626 xrayRegistration : "PASS" ,
37- cigaretteLicense : "PASS" ,
38- cigaretteEmailClient : "PASS" ,
3927 taxFilingClient : "PASS" ,
4028 } ) ;
4129 } ) ;
@@ -52,8 +40,6 @@ describe("healthCheck", () => {
5240 webserviceFormation : "FAIL" ,
5341 taxClearance : "FAIL" ,
5442 xrayRegistration : "FAIL" ,
55- cigaretteLicense : "FAIL" ,
56- cigaretteEmailClient : "FAIL" ,
5743 taxFilingClient : "FAIL" ,
5844 } ) ;
5945 } ) ;
@@ -70,27 +56,7 @@ describe("healthCheck", () => {
7056 webserviceFormation : "ERROR" ,
7157 taxClearance : "ERROR" ,
7258 xrayRegistration : "ERROR" ,
73- cigaretteLicense : "ERROR" ,
74- cigaretteEmailClient : "ERROR" ,
7559 taxFilingClient : "ERROR" ,
7660 } ) ;
7761 } ) ;
78-
79- describe ( "flagged health checks" , ( ) => {
80- it ( "includes cigarette health checks when feature flag is on" , async ( ) => {
81- const result = await runHealthChecks ( logger ) ;
82- expect ( Object . keys ( result ) ) . toContain ( "cigaretteLicense" ) ;
83- expect ( Object . keys ( result ) ) . toContain ( "cigaretteEmailClient" ) ;
84- } ) ;
85-
86- it ( "excludes cigarette health checks when feature flag is off" , async ( ) => {
87- mockGetConfigValue . mockImplementation ( async ( ) => {
88- return "false" ;
89- } ) ;
90-
91- const result = await runHealthChecks ( logger ) ;
92- expect ( Object . keys ( result ) ) . not . toContain ( "cigaretteLicense" ) ;
93- expect ( Object . keys ( result ) ) . not . toContain ( "cigaretteEmailClient" ) ;
94- } ) ;
95- } ) ;
9662} ) ;
0 commit comments