Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/invite_members/mock_data/api_responses.js')
-rw-r--r--spec/frontend/invite_members/mock_data/api_responses.js52
1 files changed, 36 insertions, 16 deletions
diff --git a/spec/frontend/invite_members/mock_data/api_responses.js b/spec/frontend/invite_members/mock_data/api_responses.js
index 4f773009f37..9190f85d7a0 100644
--- a/spec/frontend/invite_members/mock_data/api_responses.js
+++ b/spec/frontend/invite_members/mock_data/api_responses.js
@@ -6,36 +6,56 @@ const ERROR_EMAIL_INVALID = {
error: 'email contains an invalid email address',
};
+const BASE_ERROR_MEMBER_NOT_ALLOWED = `The member's email address is not allowed for this project. \
+Go to the 'Admin area > Sign-up restrictions', and check`;
+
+const ALLOWED_DOMAIN_ERROR = `${BASE_ERROR_MEMBER_NOT_ALLOWED} 'Allowed domains for sign-ups'.`;
+const DOMAIN_DENYLIST_ERROR = `${BASE_ERROR_MEMBER_NOT_ALLOWED} the 'Domain denylist'.`;
+
+function htmlDecode(input) {
+ const doc = new DOMParser().parseFromString(input, 'text/html');
+ return doc.documentElement.textContent;
+}
+
+const DECODED_ALLOWED_DOMAIN_ERROR = htmlDecode(ALLOWED_DOMAIN_ERROR);
+const DECODED_DOMAIN_DENYLIST_ERROR = htmlDecode(DOMAIN_DENYLIST_ERROR);
+
const EMAIL_RESTRICTED = {
message: {
- 'email@example.com':
- "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.",
+ 'email@example.com': ALLOWED_DOMAIN_ERROR,
+ },
+ parsedMessage: {
+ 'email@example.com': DECODED_ALLOWED_DOMAIN_ERROR,
},
status: 'error',
};
const MULTIPLE_RESTRICTED = {
message: {
- 'email@example.com':
- "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.",
- 'email4@example.com':
- "The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check the Domain denylist.",
- root:
- "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.",
+ 'email@example.com': ALLOWED_DOMAIN_ERROR,
+ 'email4@example.com': DOMAIN_DENYLIST_ERROR,
+ root: ALLOWED_DOMAIN_ERROR,
+ },
+ parsedMessage: {
+ 'email@example.com': DECODED_ALLOWED_DOMAIN_ERROR,
+ 'email4@example.com': DECODED_DOMAIN_DENYLIST_ERROR,
+ root: DECODED_ALLOWED_DOMAIN_ERROR,
},
status: 'error',
};
const EXPANDED_RESTRICTED = {
message: {
- 'email@example.com':
- "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.",
- 'email4@example.com':
- "The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check the Domain denylist.",
- 'email5@example.com':
- "The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check the Domain denylist.",
- root:
- "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.",
+ 'email@example.com': ALLOWED_DOMAIN_ERROR,
+ 'email4@example.com': DOMAIN_DENYLIST_ERROR,
+ 'email5@example.com': DOMAIN_DENYLIST_ERROR,
+ root: ALLOWED_DOMAIN_ERROR,
+ },
+ parsedMessage: {
+ 'email@example.com': DECODED_ALLOWED_DOMAIN_ERROR,
+ 'email4@example.com': DECODED_DOMAIN_DENYLIST_ERROR,
+ 'email5@example.com': DECODED_DOMAIN_DENYLIST_ERROR,
+ root: DECODED_ALLOWED_DOMAIN_ERROR,
},
status: 'error',
};