Skip to content

Commit

Permalink
feat: add message for OverlappingPriceValidity error code
Browse files Browse the repository at this point in the history
  • Loading branch information
ragafus committed May 9, 2024
1 parent f8f413c commit c319ff6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/i18n/data/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
"developer_comment": "User attempts to create a resource while having already reached the limit",
"string": "The project reached the limit for the resource. To add more resources delete existing ones or reach out to the administrator or contact customer support."
},
"ApiError.OverlappingPriceValidity": {
"developer_comment": "Returned when a given price validity period conflicts with an existing one",
"string": "Two prices have overlapping validity periods."
},
"ApiError.OverlappingPrices": {
"developer_comment": "",
"string": "Sorry, but a price with these details already exists. Please amend the price details so that they do not overlap with another price before saving."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ describe('render', () => {
)
).toBeInTheDocument();
});
it('should show message for OverlappingPriceValidity', () => {
const error = {
extensions: { code: 'OverlappingPriceValidity' },
message: 'message-content',
};
renderMessage(<ApiErrorMessage error={error} />);
expect(
screen.getByText('Two prices have overlapping validity periods.')
).toBeInTheDocument();
});
it('should show message for OverlappingStandalonePriceValidity', () => {
const error = {
extensions: { code: 'OverlappingStandalonePriceValidity' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ export default defineMessages({
defaultMessage:
'Slugs may only contain alphanumeric (0-9A-Z) characters, underscores and hyphens and must have a length between 2 and 256 characters.',
},
OverlappingPriceValidity: {
id: 'ApiError.OverlappingPriceValidity',
description:
'Returned when a given price validity period conflicts with an existing one',
defaultMessage: 'Two prices have overlapping validity periods.',
},
OverlappingStandalonePriceValidity: {
id: 'ApiError.OverlappingStandalonePriceValidity',
description:
Expand Down

0 comments on commit c319ff6

Please sign in to comment.