@@ -10,6 +10,7 @@ import {
1010 isErrorResponse ,
1111 isGetLettersResponse ,
1212} from "../../helpers/generate-fetch-test-data" ;
13+ import { SUPPLIER_LETTERS } from "../../constants/api-constants" ;
1314
1415let baseUrl : string ;
1516
@@ -34,6 +35,37 @@ test.describe("API Gateway Tests To Get List Of Pending Letters", () => {
3435 throw new Error ( "Expected GetLettersResponse body for 200 status" ) ;
3536 }
3637 expect ( responseBody . data . length ) . toBeGreaterThanOrEqual ( 1 ) ;
38+
39+ responseBody . data . forEach ( ( letter ) => {
40+ expect ( letter . attributes . sha256Hash ) . toBeDefined ( ) ;
41+ expect ( letter . attributes . sha256Hash ) . not . toBeNull ( ) ;
42+ } ) ;
43+ } ) ;
44+
45+ test ( "GET /letters retrieve letter should match SHA256 from GET /letter{id} of the same letter" , async ( { request } ) => {
46+ const headers = createValidRequestHeaders ( ) ;
47+ const { responseBody, statusCode } = await getLettersWithRetry (
48+ request ,
49+ baseUrl ,
50+ headers ,
51+ {
52+ lettersLimit : "2" ,
53+ } ,
54+ ) ;
55+
56+ expect ( statusCode ) . toBe ( 200 ) ;
57+ if ( ! isGetLettersResponse ( responseBody ) ) {
58+ throw new Error ( "Expected GetLettersResponse body for 200 status" ) ;
59+ }
60+ expect ( responseBody . data . length ) . toBeGreaterThanOrEqual ( 1 ) ;
61+ const getLettersSha = responseBody . data [ 0 ] . attributes . sha256Hash ;
62+ const id = responseBody . data [ 0 ] . id ;
63+ const response = await request . get ( `${ baseUrl } /${ SUPPLIER_LETTERS } /${ id } ` , {
64+ headers,
65+ } ) ;
66+ const letterResponseBody = await response . json ( ) ;
67+ expect ( response . status ( ) ) . toBe ( 200 ) ;
68+ expect ( letterResponseBody . data . attributes . sha256Hash ) . toBe ( getLettersSha ) ;
3769 } ) ;
3870
3971 test ( "GET /letters with invalid authentication should return 403" , async ( {
0 commit comments