@@ -33,6 +33,19 @@ describe('@dotcom-reliability-kit/fetch-error-handler/lib/create-handler', () =>
3333 expect ( resolvedValue ) . toStrictEqual ( mockResponse ) ;
3434 } ) ;
3535
36+ describe ( 'when `response.ok` is `false` and `response.status` is 304' , ( ) => {
37+ it ( 'resolves with the response object' , async ( ) => {
38+ expect . assertions ( 1 ) ;
39+ try {
40+ mockResponse . ok = false ;
41+ mockResponse . status = 304 ;
42+ await fetchErrorHandler ( mockResponse ) ;
43+ } catch ( error ) {
44+ expect ( resolvedValue ) . toStrictEqual ( mockResponse ) ;
45+ }
46+ } ) ;
47+ } ) ;
48+
3649 describe ( 'when `response.ok` is `false` and `response.status` is 400' , ( ) => {
3750 it ( 'rejects with an error describing the issue' , async ( ) => {
3851 expect . assertions ( 3 ) ;
@@ -162,6 +175,19 @@ describe('@dotcom-reliability-kit/fetch-error-handler/lib/create-handler', () =>
162175 expect ( resolvedValue ) . toStrictEqual ( mockResponse ) ;
163176 } ) ;
164177
178+ describe ( 'when `response.ok` is `false` and `response.status` is 304' , ( ) => {
179+ it ( 'resolves with the response object' , async ( ) => {
180+ expect . assertions ( 1 ) ;
181+ try {
182+ mockResponse . ok = false ;
183+ mockResponse . status = 304 ;
184+ await fetchErrorHandler ( Promise . resolve ( mockResponse ) ) ;
185+ } catch ( error ) {
186+ expect ( resolvedValue ) . toStrictEqual ( mockResponse ) ;
187+ }
188+ } ) ;
189+ } ) ;
190+
165191 describe ( 'when `response.ok` is `false` and `response.status` is >= 400' , ( ) => {
166192 it ( 'rejects with an error' , async ( ) => {
167193 expect . assertions ( 1 ) ;
0 commit comments