diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/invite_members/utils/response_message_parser_spec.js | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/invite_members/utils/response_message_parser_spec.js')
-rw-r--r-- | spec/frontend/invite_members/utils/response_message_parser_spec.js | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/spec/frontend/invite_members/utils/response_message_parser_spec.js b/spec/frontend/invite_members/utils/response_message_parser_spec.js index e2cc87c8547..8b2064df374 100644 --- a/spec/frontend/invite_members/utils/response_message_parser_spec.js +++ b/spec/frontend/invite_members/utils/response_message_parser_spec.js @@ -2,23 +2,19 @@ import { responseMessageFromSuccess, responseMessageFromError, } from '~/invite_members/utils/response_message_parser'; -import { membersApiResponse, invitationsApiResponse } from '../mock_data/api_responses'; +import { invitationsApiResponse } from '../mock_data/api_responses'; describe('Response message parser', () => { const expectedMessage = 'expected display and message.'; describe('parse message from successful response', () => { const exampleKeyedMsg = { 'email@example.com': expectedMessage }; - const exampleFirstPartMultiple = 'username1: expected display and message.'; - const exampleUserMsgMultiple = - ' and username2: id not found and restricted email. and username3: email is restricted.'; it.each([ - [[{ data: { message: expectedMessage } }]], - [[{ data: { message: exampleFirstPartMultiple + exampleUserMsgMultiple } }]], - [[{ data: { error: expectedMessage } }]], - [[{ data: { message: [expectedMessage] } }]], - [[{ data: { message: exampleKeyedMsg } }]], + [{ data: { message: expectedMessage } }], + [{ data: { error: expectedMessage } }], + [{ data: { message: [expectedMessage] } }], + [{ data: { message: exampleKeyedMsg } }], ])(`returns "${expectedMessage}" from success response: %j`, (successResponse) => { expect(responseMessageFromSuccess(successResponse)).toBe(expectedMessage); }); @@ -27,8 +23,6 @@ describe('Response message parser', () => { describe('message from error response', () => { it.each([ [{ response: { data: { error: expectedMessage } } }], - [{ response: { data: { message: { user: [expectedMessage] } } } }], - [{ response: { data: { message: { access_level: [expectedMessage] } } } }], [{ response: { data: { message: { error: expectedMessage } } } }], [{ response: { data: { message: expectedMessage } } }], ])(`returns "${expectedMessage}" from error response: %j`, (errorResponse) => { @@ -41,18 +35,10 @@ describe('Response message parser', () => { "The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check Allowed domains for sign-ups."; it.each([ - [[{ data: membersApiResponse.MULTIPLE_USERS_RESTRICTED }]], - [[{ data: invitationsApiResponse.MULTIPLE_EMAIL_RESTRICTED }]], - [[{ data: invitationsApiResponse.EMAIL_RESTRICTED }]], + [{ data: invitationsApiResponse.MULTIPLE_RESTRICTED }], + [{ data: invitationsApiResponse.EMAIL_RESTRICTED }], ])(`returns "${expectedMessage}" from success response: %j`, (restrictedResponse) => { expect(responseMessageFromSuccess(restrictedResponse)).toBe(expected); }); - - it.each([[{ response: { data: membersApiResponse.SINGLE_USER_RESTRICTED } }]])( - `returns "${expectedMessage}" from error response: %j`, - (singleRestrictedResponse) => { - expect(responseMessageFromError(singleRestrictedResponse)).toBe(expected); - }, - ); }); }); |