Skip to content

Commit

Permalink
Refine error message
Browse files Browse the repository at this point in the history
Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong committed Apr 22, 2024
1 parent 248361d commit 5bee9fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cypress/utils/dashboards/workspace-plugin/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Cypress.Commands.add('checkWorkspace', (workspaceId, expected) => {
expected.features.forEach((feature) => {
if (!features.includes(feature)) {
throw new Error(
`workspace ${workspaceId} is not as expected, expected features are: ${expectedFeatures}, but are: ${actualFeatures}`
`workspace ${workspaceId} is not as expected because the feature ${feature} is missing, expected features are: ${expectedFeatures}, but are: ${actualFeatures}`
);
}
});
Expand All @@ -100,14 +100,14 @@ Cypress.Commands.add('checkWorkspace', (workspaceId, expected) => {
Object.keys(permissions).length !== Object.keys(expected.permissions)
) {
throw new Error(
`workspace ${workspaceId} is not as expected, expected features are: ${expectedFeatures}, but are: ${actualFeatures}`
`permissions for workspace ${workspaceId} is not as expected, expected permissions are: ${expectedPermissions}, but are: ${actualPermissions}`
);
}

Object.entries(permissions).forEach(([key, value]) => {
if (!expected.permissions[key]) {
throw new Error(
`permissions for workspace ${workspaceId} is not as expected, expected are: ${expectedPermissions}, but are ${actualPermissions}`
`permissions for workspace ${workspaceId} is not as expected because the permission ${key} is missing, expected permissions are: ${expectedPermissions}, but are ${actualPermissions}`
);
} else {
if (
Expand All @@ -118,7 +118,7 @@ Cypress.Commands.add('checkWorkspace', (workspaceId, expected) => {
)
) {
throw new Error(
`permissions for workspace ${workspaceId} is not as expected, expected are: ${expectedPermissions}, but are ${actualPermissions}`
`permissions for workspace ${workspaceId} is not as expected, expected permissions are: ${expectedPermissions}, but are ${actualPermissions}`
);
}

Expand All @@ -130,7 +130,7 @@ Cypress.Commands.add('checkWorkspace', (workspaceId, expected) => {
)
) {
throw new Error(
`permissions for workspace ${workspaceId} is not as expected, expected are: ${expectedPermissions}, but are ${actualPermissions}`
`permissions for workspace ${workspaceId} is not as expected, expected permissions are: ${expectedPermissions}, but are ${actualPermissions}`
);
}
}
Expand Down

0 comments on commit 5bee9fe

Please sign in to comment.