PromucFlow_constructor/app/client/src/ce/constants/messages.test.ts
albinAppsmith 629999f124
feat: [epic] appsmith design system version 2 deduplication (#22030)
## Description

### Fixes
- [x] https://github.com/appsmithorg/appsmith/issues/19383
- [x] https://github.com/appsmithorg/appsmith/issues/19384
- [x] https://github.com/appsmithorg/appsmith/issues/19385
- [x] https://github.com/appsmithorg/appsmith/issues/19386
- [x] https://github.com/appsmithorg/appsmith/issues/19387
- [x] https://github.com/appsmithorg/appsmith/issues/19388
- [x] https://github.com/appsmithorg/appsmith/issues/19389
- [x] https://github.com/appsmithorg/appsmith/issues/19390
- [x] https://github.com/appsmithorg/appsmith/issues/19391
- [x] https://github.com/appsmithorg/appsmith/issues/19392
- [x] https://github.com/appsmithorg/appsmith/issues/19393
- [x] https://github.com/appsmithorg/appsmith/issues/19394
- [x] https://github.com/appsmithorg/appsmith/issues/19395
- [x] https://github.com/appsmithorg/appsmith/issues/19396
- [x] https://github.com/appsmithorg/appsmith/issues/19397
- [x] https://github.com/appsmithorg/appsmith/issues/19398
- [x] https://github.com/appsmithorg/appsmith/issues/19399
- [x] https://github.com/appsmithorg/appsmith/issues/19400
- [x] https://github.com/appsmithorg/appsmith/issues/19401
- [x] https://github.com/appsmithorg/appsmith/issues/19402
- [x] https://github.com/appsmithorg/appsmith/issues/19403
- [x] https://github.com/appsmithorg/appsmith/issues/19404
- [x] https://github.com/appsmithorg/appsmith/issues/19405
- [x] https://github.com/appsmithorg/appsmith/issues/19406
- [x] https://github.com/appsmithorg/appsmith/issues/19407
- [x] https://github.com/appsmithorg/appsmith/issues/19408
- [x] https://github.com/appsmithorg/appsmith/issues/19409

Fixes # (issue)
> if no issue exists, please create an issue and ask the maintainers
about this first


Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video


## Type of change

> Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update


## How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Provide
instructions, so we can reproduce.
> Please also list any relevant details for your test configuration.
> Delete anything that is not important

- Manual
- Jest
- Cypress

### Test Plan
> Add Testsmith test cases links that relate to this PR

### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)


## Checklist:
### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test

---------

Co-authored-by: Ankita Kinger <ankita@appsmith.com>
Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com>
Co-authored-by: Tanvi Bhakta <tanvi@appsmith.com>
Co-authored-by: Arsalan <arsalanyaldram0211@outlook.com>
Co-authored-by: Aman Agarwal <aman@appsmith.com>
Co-authored-by: Rohit Agarwal <rohit_agarwal@live.in>
Co-authored-by: Nilesh Sarupriya <nilesh@appsmith.com>
Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
Co-authored-by: Vijetha-Kaja <vijetha@appsmith.com>
Co-authored-by: Parthvi <80334441+Parthvi12@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
Co-authored-by: Saroj <43822041+sarojsarab@users.noreply.github.com>
Co-authored-by: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com>
Co-authored-by: rahulramesha <rahul@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com>
Co-authored-by: Vijetha-Kaja <119562824+Vijetha-Kaja@users.noreply.github.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-05-20 00:07:06 +05:30

473 lines
13 KiB
TypeScript

import {
ARE_YOU_SURE,
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
CHANGES_ONLY_MIGRATION,
CHANGES_ONLY_USER,
CHANGES_USER_AND_MIGRATION,
COMMIT_AND_PUSH,
COMMIT_CHANGES,
COMMIT_TO,
COMMITTING_AND_PUSHING_CHANGES,
CONNECT_BTN_LABEL,
CONNECT_GIT,
CONNECT_GIT_BETA,
CONNECT_TO_GIT,
CONNECT_TO_GIT_SUBTITLE,
CONTACT_SUPPORT,
CONTACT_SUPPORT_TO_UPGRADE,
COPIED_SSH_KEY,
COPY_SSH_KEY,
CREATE_NEW_BRANCH,
createMessage,
DEPLOY,
DEPLOY_KEY_USAGE_GUIDE_MESSAGE,
DISCARD_CHANGES,
DISCARD_CHANGES_WARNING,
DISCARD_SUCCESS,
DISCARDING_AND_PULLING_CHANGES,
DISCONNECT,
REVOKE_CAUSE_APPLICATION_BREAK,
REVOKE_EXISTING_REPOSITORIES_INFO,
REVOKE_GIT,
ERROR_GIT_AUTH_FAIL,
ERROR_GIT_INVALID_REMOTE,
ERROR_WHILE_PULLING_CHANGES,
ERROR_WIDGET_COPY_NOT_ALLOWED,
FETCH_GIT_STATUS,
FETCH_MERGE_STATUS,
FETCH_MERGE_STATUS_FAILURE,
GENERATE_KEY,
GIT_COMMIT_MESSAGE_PLACEHOLDER,
GIT_CONFLICTING_INFO,
GIT_CONNECTION,
GIT_DISCONNECTION_SUBMENU,
GIT_SETTINGS,
GIT_UPSTREAM_CHANGES,
GIT_USER_UPDATED_SUCCESSFULLY,
IMPORT_APP_FROM_FILE_MESSAGE,
IMPORT_APP_FROM_GIT_MESSAGE,
IMPORT_FROM_GIT_REPOSITORY,
IMPORTING_APP_FROM_GIT,
INVALID_USER_DETAILS_MSG,
IS_MERGING,
MERGE,
MERGE_CHANGES,
MERGE_CONFLICT_ERROR,
MERGED_SUCCESSFULLY,
NO_MERGE_CONFLICT,
NONE_REVERSIBLE_MESSAGE,
PASTE_SSH_URL_INFO,
PULL_CHANGES,
REGENERATE_KEY_CONFIRM_MESSAGE,
REGENERATE_SSH_KEY,
REMOTE_URL,
REMOTE_URL_INFO,
REMOTE_URL_INPUT_PLACEHOLDER,
REMOTE_URL_VIA,
REPOSITORY_LIMIT_REACHED,
REPOSITORY_LIMIT_REACHED_INFO,
RETRY,
REVOKE_EXISTING_REPOSITORIES,
SELECT_BRANCH_TO_MERGE,
SSH_KEY,
SUBMIT,
UPDATE_CONFIG,
UPLOADING_APPLICATION,
UPLOADING_JSON,
USE_DEFAULT_CONFIGURATION,
AUDIT_LOGS,
INTRODUCING,
AUDIT_LOGS_UPGRADE_PAGE_SUB_HEADING,
SECURITY_AND_COMPLIANCE,
SECURITY_AND_COMPLIANCE_DETAIL1,
SECURITY_AND_COMPLIANCE_DETAIL2,
DEBUGGING,
DEBUGGING_DETAIL1,
INCIDENT_MANAGEMENT,
INCIDENT_MANAGEMENT_DETAIL1,
AVAILABLE_ON_BUSINESS,
EXCLUSIVE_TO_BUSINESS,
} from "./messages";
describe("messages", () => {
it("checks for ERROR_WIDGET_COPY_NOT_ALLOWED string", () => {
expect(ERROR_WIDGET_COPY_NOT_ALLOWED()).toBe(
"This selected widget cannot be copied.",
);
});
});
describe("messages without input", () => {
const expectedMessages = [
{ key: "COMMIT_CHANGES", value: "Commit changes" },
{
key: "COMMIT_TO",
value: "Commit to",
},
{ key: "COMMIT_AND_PUSH", value: "Commit & push" },
{
key: "PULL_CHANGES",
value: "Pull changes",
},
{ key: "SSH_KEY", value: "SSH key" },
{
key: "COPY_SSH_KEY",
value: "Copy SSH key",
},
{
key: "REGENERATE_KEY_CONFIRM_MESSAGE",
value:
"This might cause the application to break. This key needs to be updated in your Git repository too!",
},
{
key: "DEPLOY_KEY_USAGE_GUIDE_MESSAGE",
value:
"Paste this key in your repository settings and give it write access.",
},
{
key: "COMMITTING_AND_PUSHING_CHANGES",
value: "Committing and pushing changes...",
},
{ key: "IS_MERGING", value: "Merging changes..." },
{
key: "MERGE_CHANGES",
value: "Merge changes",
},
{ key: "SELECT_BRANCH_TO_MERGE", value: "Select branch to merge" },
{
key: "CONNECT_GIT",
value: "Connect Git",
},
{ key: "CONNECT_GIT_BETA", value: "Connect Git (Beta)" },
{
key: "RETRY",
value: "Retry",
},
{ key: "CREATE_NEW_BRANCH", value: "Create new branch" },
{
key: "ERROR_WHILE_PULLING_CHANGES",
value: "ERROR WHILE PULLING CHANGES",
},
{ key: "SUBMIT", value: "Submit" },
{
key: "GIT_USER_UPDATED_SUCCESSFULLY",
value: "Git user updated successfully",
},
{
key: "REMOTE_URL_INPUT_PLACEHOLDER",
value: "git@example.com:user/repository.git",
},
{ key: "COPIED_SSH_KEY", value: "Copied SSH key" },
{
key: "INVALID_USER_DETAILS_MSG",
value: "Please enter valid user details",
},
{
key: "PASTE_SSH_URL_INFO",
value: "Please enter a valid SSH URL of your repository",
},
{ key: "GENERATE_KEY", value: "Generate key" },
{
key: "UPDATE_CONFIG",
value: "Update config",
},
{ key: "CONNECT_BTN_LABEL", value: "Connect" },
{
key: "FETCH_GIT_STATUS",
value: "Fetching status...",
},
{ key: "FETCH_MERGE_STATUS", value: "Checking mergeability..." },
{
key: "NO_MERGE_CONFLICT",
value: "This branch has no conflicts with the base branch.",
},
{ key: "MERGE_CONFLICT_ERROR", value: "Merge conflicts found!" },
{
key: "FETCH_MERGE_STATUS_FAILURE",
value: "Unable to fetch merge status",
},
{
key: "GIT_UPSTREAM_CHANGES",
value:
"Looks like there are pending upstream changes. We will pull the changes and push them to your repository.",
},
{
key: "GIT_CONFLICTING_INFO",
value: "Please resolve the merge conflicts manually on your repository.",
},
{
key: "CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES",
value:
"You have uncommitted changes. Please commit before pulling the remote changes.",
},
{
key: "CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES",
value:
"Your current branch has uncommitted changes. Please commit them before proceeding to merge.",
},
{
key: "REVOKE_EXISTING_REPOSITORIES",
value: "Revoke Existing Repositories",
},
{
key: "REVOKE_EXISTING_REPOSITORIES_INFO",
value:
"To make space for newer repositories, you can remove existing repositories.",
},
{ key: "CONTACT_SUPPORT", value: "Contact Support" },
{
key: "REPOSITORY_LIMIT_REACHED",
value: "Repository Limit Reached",
},
{
key: "REPOSITORY_LIMIT_REACHED_INFO",
value:
"Adding and using upto 3 repositories is free. To add more repositories, kindly upgrade.",
},
{
key: "NONE_REVERSIBLE_MESSAGE",
value: "This action is non-reversible. Please proceed with caution.",
},
{
key: "CONTACT_SUPPORT_TO_UPGRADE",
value:
"Please contact support to upgrade. You can add unlimited private repositories in upgraded plan.",
},
{
key: "REVOKE_CAUSE_APPLICATION_BREAK",
value: "Revoking your repository might cause the application to break.",
},
{ key: "REVOKE_GIT", value: "Revoke access" },
{
key: "DISCONNECT",
value: "Disconnect",
},
{ key: "GIT_DISCONNECTION_SUBMENU", value: "Git Connection > Disconnect" },
{
key: "USE_DEFAULT_CONFIGURATION",
value: "Use default configuration",
},
{
key: "GIT_COMMIT_MESSAGE_PLACEHOLDER",
value: "Your commit message here",
},
{ key: "GIT_CONNECTION", value: "Git connection" },
{ key: "DEPLOY", value: "Deploy" },
{
key: "MERGE",
value: "Merge",
},
{ key: "GIT_SETTINGS", value: "Git settings" },
{ key: "CONNECT_TO_GIT", value: "Connect to Git repository" },
{
key: "CONNECT_TO_GIT_SUBTITLE",
value: "Checkout branches, make commits, and deploy your application",
},
{ key: "REMOTE_URL", value: "Remote URL" },
{
key: "REMOTE_URL_INFO",
value: `Create an empty Git repository and paste the remote URL here.`,
},
{ key: "REMOTE_URL_VIA", value: "Remote URL via" },
{
key: "ERROR_GIT_AUTH_FAIL",
value:
"Please make sure that regenerated SSH key is added and has write access to the repository.",
},
{
key: "ERROR_GIT_INVALID_REMOTE",
value: "Either the remote repository doesn't exist or is unreachable.",
},
{
key: "CHANGES_ONLY_USER",
value: "Changes since last commit",
},
{
key: "CHANGES_ONLY_MIGRATION",
value: "Appsmith update changes since last commit",
},
{
key: "CHANGES_USER_AND_MIGRATION",
value: "Appsmith update and user changes since last commit",
},
{ key: "MERGED_SUCCESSFULLY", value: "Merged successfully" },
{
key: "DISCARD_CHANGES_WARNING",
value: "Discarding these changes will pull previous changes from Git.",
},
{
key: "DISCARD_SUCCESS",
value: "Discarded changes successfully.",
},
{
key: "DISCARDING_AND_PULLING_CHANGES",
value: "Discarding and pulling changes...",
},
{
key: "ARE_YOU_SURE",
value: "Are you sure?",
},
{
key: "DISCARD_CHANGES",
value: "Discard changes",
},
{
key: "IMPORTING_APP_FROM_GIT",
value: "Importing application from Git",
},
{ key: "UPLOADING_JSON", value: "Uploading JSON file" },
{
key: "UPLOADING_APPLICATION",
value: "Uploading application",
},
{
key: "IMPORT_APP_FROM_FILE_MESSAGE",
value: "Drag and drop your file or upload from your computer",
},
{
key: "IMPORT_APP_FROM_GIT_MESSAGE",
value: "Import an application from its Git repository using its SSH URL",
},
{
key: "IMPORT_FROM_GIT_REPOSITORY",
value: "Import from Git repository",
},
];
const functions = [
ARE_YOU_SURE,
CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES,
CANNOT_PULL_WITH_LOCAL_UNCOMMITTED_CHANGES,
CHANGES_ONLY_MIGRATION,
CHANGES_ONLY_USER,
CHANGES_USER_AND_MIGRATION,
COMMITTING_AND_PUSHING_CHANGES,
COMMIT_AND_PUSH,
COMMIT_CHANGES,
COMMIT_TO,
CONNECT_BTN_LABEL,
CONNECT_GIT,
CONNECT_GIT_BETA,
CONNECT_TO_GIT,
CONNECT_TO_GIT_SUBTITLE,
CONTACT_SUPPORT,
CONTACT_SUPPORT_TO_UPGRADE,
COPIED_SSH_KEY,
COPY_SSH_KEY,
CREATE_NEW_BRANCH,
DEPLOY,
DEPLOY_KEY_USAGE_GUIDE_MESSAGE,
DISCARDING_AND_PULLING_CHANGES,
DISCARD_CHANGES,
DISCARD_CHANGES_WARNING,
DISCARD_SUCCESS,
DISCONNECT,
REVOKE_CAUSE_APPLICATION_BREAK,
REVOKE_EXISTING_REPOSITORIES,
REVOKE_EXISTING_REPOSITORIES_INFO,
REVOKE_GIT,
ERROR_GIT_AUTH_FAIL,
ERROR_GIT_INVALID_REMOTE,
ERROR_WHILE_PULLING_CHANGES,
FETCH_GIT_STATUS,
FETCH_MERGE_STATUS,
FETCH_MERGE_STATUS_FAILURE,
GENERATE_KEY,
GIT_COMMIT_MESSAGE_PLACEHOLDER,
GIT_CONFLICTING_INFO,
GIT_CONNECTION,
GIT_DISCONNECTION_SUBMENU,
GIT_SETTINGS,
GIT_UPSTREAM_CHANGES,
GIT_USER_UPDATED_SUCCESSFULLY,
IMPORTING_APP_FROM_GIT,
INVALID_USER_DETAILS_MSG,
IS_MERGING,
MERGE,
MERGE_CHANGES,
MERGE_CONFLICT_ERROR,
NONE_REVERSIBLE_MESSAGE,
NO_MERGE_CONFLICT,
MERGED_SUCCESSFULLY,
PASTE_SSH_URL_INFO,
PULL_CHANGES,
REGENERATE_KEY_CONFIRM_MESSAGE,
REMOTE_URL,
REMOTE_URL_INFO,
REMOTE_URL_INPUT_PLACEHOLDER,
REMOTE_URL_VIA,
REPOSITORY_LIMIT_REACHED,
REPOSITORY_LIMIT_REACHED_INFO,
RETRY,
SELECT_BRANCH_TO_MERGE,
SSH_KEY,
SUBMIT,
UPDATE_CONFIG,
USE_DEFAULT_CONFIGURATION,
UPLOADING_JSON,
UPLOADING_APPLICATION,
IMPORT_APP_FROM_FILE_MESSAGE,
IMPORT_APP_FROM_GIT_MESSAGE,
IMPORT_FROM_GIT_REPOSITORY,
];
functions.forEach((fn: () => string) => {
it(`${fn.name} returns expected value`, () => {
const actual = createMessage(fn);
const found = expectedMessages.find((em) => em.key === fn.name);
const expected = found && found.value;
expect(actual).toEqual(expected);
});
});
});
describe("messages with input values", () => {
it("REGENERATE_SSH_KEY returns expected value", () => {
expect(createMessage(REGENERATE_SSH_KEY)).toEqual(
"Regenerate undefined undefined key",
);
expect(createMessage(REGENERATE_SSH_KEY, "ECDSA", 256)).toEqual(
"Regenerate ECDSA 256 key",
);
});
});
describe("Audit logs messages", () => {
it("without input strings match successfully", () => {
const input = [
AUDIT_LOGS,
AUDIT_LOGS_UPGRADE_PAGE_SUB_HEADING,
SECURITY_AND_COMPLIANCE,
SECURITY_AND_COMPLIANCE_DETAIL1,
SECURITY_AND_COMPLIANCE_DETAIL2,
DEBUGGING,
DEBUGGING_DETAIL1,
INCIDENT_MANAGEMENT,
INCIDENT_MANAGEMENT_DETAIL1,
AVAILABLE_ON_BUSINESS,
];
const expected = [
"Audit logs",
"See a timestamped trail of events in your workspace. Filter by type of event, user, resource ID, and time. Drill down into each event to investigate further.",
"Security & compliance",
"Proactively derisk misconfigured permissions, roll back changes from a critical security event, and keep checks against your compliance policies.",
"Exports to popular compliance tools coming soon",
"Debugging",
"Debug with a timeline of events filtered by user and resource ID, correlate them with end-user and app developer actions, and investigate back to the last known good state of your app.",
"Incident management",
"Go back in time from an incident to see who did what, correlate events with breaking changes, and run RCAs to remediate incidents for now and the future.",
"Available on a business plan only",
];
const actual = input.map((f) => createMessage(f));
expect(actual).toEqual(expected);
});
it("with input strings match successfully", () => {
const input = [INTRODUCING, EXCLUSIVE_TO_BUSINESS];
const expected = [
`Introducing XYZ`,
`The XYZ feature is exclusive to workspaces on the Business Plan`,
];
const actual = input.map((f) => createMessage(f, "XYZ"));
expect(actual).toEqual(expected);
});
});