Skip to content

Commit

Permalink
Administration: Adjust the "No private directive present in cache con…
Browse files Browse the repository at this point in the history
…trol 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
  • Loading branch information
johnbillion committed Jul 4, 2023
1 parent 56af1e4 commit 77c59ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/e2e/specs/cache-control-headers-directives.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
} );

} );

0 comments on commit 77c59ac

Please sign in to comment.