-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E Framework: fix empty array check in RestAPIClient. (#74741)
* packages/calypso-e2e/src/rest-api-client.ts - fix empty array check * packages/calypso-e2e/src/rest-api-client.ts - fix another instance of comparison * packages/calypso-e2e/src/rest-api-client.ts - fix if logic. - add output. - add comments. * packages/calypso-e2e/src/rest-api-client.ts - truthy check * packages/calypso-e2e/src/test/rest-api-client.invites.test.ts - fix test
- Loading branch information
1 parent
1418db6
commit 1d87e23
Showing
2 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,7 @@ describe( 'RestAPIClient: createInvite', function () { | |
expect( response.errors.length ).toBe( 0 ); | ||
} ); | ||
|
||
test( 'Invite cannot be created', async function () { | ||
test( 'Invite is rejected due to existing user email', async function () { | ||
const testSuccessfulEmails = [ '[email protected]' ]; | ||
const testFailedEmails = [ '[email protected]' ]; | ||
const role = 'Editor' as Roles; | ||
|
@@ -126,14 +126,11 @@ describe( 'RestAPIClient: createInvite', function () { | |
|
||
nock( requestURL.origin ).post( requestURL.pathname ).reply( 200, testResponse ); | ||
|
||
const response: NewInviteResponse = await restAPIClient.createInvite( siteID, { | ||
email: testSuccessfulEmails.concat( testFailedEmails ), | ||
role: role, | ||
} ); | ||
expect( response.sent ).toBeInstanceOf( Array ); | ||
expect( response.sent.length ).toBe( 1 ); | ||
expect( response.sent ).toEqual( testSuccessfulEmails ); | ||
expect( response.errors.length ).toBe( 1 ); | ||
expect( response.errors ).toEqual( testFailedEmails ); | ||
await expect( () => | ||
restAPIClient.createInvite( siteID, { | ||
email: testSuccessfulEmails.concat( testFailedEmails ), | ||
role: role, | ||
} ) | ||
).rejects.toThrowError(); | ||
} ); | ||
} ); |