-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* PMM-10847 Fix invalid mongo query example crash * PMM-10847 Update message & add test * PMM-10847 Extract Parse Error into own component * PMM-10847 Use only part of message
- Loading branch information
1 parent
6ee32f8
commit 2024267
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
pmm-app/src/pmm-qan/panel/components/Details/Example/ParseError/ParseError.messages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const Messages = { | ||
parsingFailed: | ||
'Example query is not successfully parsed due to the max query length limit that you set or set by default.', | ||
}; |
12 changes: 12 additions & 0 deletions
12
pmm-app/src/pmm-qan/panel/components/Details/Example/ParseError/ParseError.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import ParseError from './ParseError'; | ||
import { Messages } from './ParseError.messages'; | ||
|
||
describe('Parse Error Message', () => { | ||
it('renders with correct message', () => { | ||
const { container } = render(<ParseError />); | ||
|
||
expect(container.textContent).toBe(Messages.parsingFailed); | ||
}); | ||
}); |
6 changes: 6 additions & 0 deletions
6
pmm-app/src/pmm-qan/panel/components/Details/Example/ParseError/ParseError.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import { Messages } from './ParseError.messages'; | ||
|
||
const ParseError: React.FC = () => <pre data-testid="example-query-invalid">{Messages.parsingFailed}</pre>; | ||
|
||
export default ParseError; |