Make WordPress Core

Changeset 56134


Ignore:
Timestamp:
07/04/2023 11:30:36 PM (2 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/e2e/specs/cache-control-headers-directives.test.js

    r55968 r56134  
    2121
    2222        const response = await page.goto( createURL( '/hello-world/' ) );
    23         const cacheControl = response.headers();
     23        const responseHeaders = response.headers();
    2424
    25         expect( cacheControl[ 'cache-control' ] ).not.toContain( 'no-store' );
    26         expect( cacheControl[ 'cache-control' ] ).not.toContain( 'private' );
     25        expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "no-store" } ) );
     26        expect( responseHeaders ).toEqual( expect.not.objectContaining( { "cache-control": "private" } ) );
    2727    } );
    2828
     
    3131
    3232        const response = await page.goto( createURL( '/wp-admin' ) );
    33         const cacheControl = response.headers();
     33        const responseHeaders = response.headers();
    3434
    35         expect( cacheControl[ 'cache-control' ] ).toContain( 'no-store' );
    36         expect( cacheControl[ 'cache-control' ] ).toContain( 'private' );
     35        expect( responseHeaders[ 'cache-control' ] ).toContain( 'no-store' );
     36        expect( responseHeaders[ 'cache-control' ] ).toContain( 'private' );
    3737    } );
    3838
Note: See TracChangeset for help on using the changeset viewer.