Skip to content

Commit

Permalink
fix: mock root request instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kielllll committed Nov 19, 2024
1 parent c2ba56a commit 0d5e852
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/e2e/tabs/tools/install-core-fonts-field.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ test( 'should return download core fonts successful response', async ( t ) => {
.ok();
} );

const mockFailure = RequestMock()
.onRequestTo( `${ baseURL }/wp-admin/admin-ajax.php` )
.respond( { message: 'Something went wrong', ok: false }, 401, {
const mockGithubError = RequestMock()
.onRequestTo(
`${ baseURL }/wp-content/plugins/gravity-pdf/build/payload/core-fonts.json`
)
.respond( { ok: false }, 500, {
'Access-Control-Allow-Origin': '*',
} );

fixture`Tools tab - Install core fonts field test failure`.requestHooks(
mockFailure
mockGithubError
);

test( 'should return download core fonts error/failed response', async ( t ) => {
Expand All @@ -53,9 +55,5 @@ test( 'should return download core fonts error/failed response', async ( t ) =>
await t.click( run.downloadCoreFontsButton );

// Assertions
await t
.expect( run.downloadFailed.exists )
.ok()
.expect( run.retryDownload.exists )
.ok();
await t.expect( run.downloadFailed.exists ).ok();
} );

0 comments on commit 0d5e852

Please sign in to comment.