From 77c59ac4f13bc273281e938b23b95a461122457f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 4 Jul 2023 23:30:36 +0000 Subject: [PATCH] Administration: Adjust the "No private directive present in cache control when user not logged in" test so the assertions won't fail if the headers don't contain a `cache-control` key at all. Props joemcgill Fixes #21938 git-svn-id: https://develop.svn.wordpress.org/trunk@56134 602fd350-edb4-49c9-b593-d223f7449a82 --- .../specs/cache-control-headers-directives.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/e2e/specs/cache-control-headers-directives.test.js b/tests/e2e/specs/cache-control-headers-directives.test.js index 808e0b2272..5ba53cc5b2 100644 --- a/tests/e2e/specs/cache-control-headers-directives.test.js +++ b/tests/e2e/specs/cache-control-headers-directives.test.js @@ -20,20 +20,20 @@ describe( 'Cache Control header directives', () => { await logout(); const response = await page.goto( createURL( '/hello-world/' ) ); - const cacheControl = response.headers(); + const responseHeaders = response.headers(); - expect( cacheControl[ 'cache-control' ] ).not.toContain( 'no-store' ); - expect( cacheControl[ 'cache-control' ] ).not.toContain( 'private' ); + expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "no-store" } ) ); + expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "private" } ) ); } ); it( 'Private directive header present in cache control when logged in.', async () => { await visitAdminPage( '/wp-admin' ); const response = await page.goto( createURL( '/wp-admin' ) ); - const cacheControl = response.headers(); + const responseHeaders = response.headers(); - expect( cacheControl[ 'cache-control' ] ).toContain( 'no-store' ); - expect( cacheControl[ 'cache-control' ] ).toContain( 'private' ); + expect( responseHeaders[ 'cache-control' ] ).toContain( 'no-store' ); + expect( responseHeaders[ 'cache-control' ] ).toContain( 'private' ); } ); } );