Limit the use of the same shortcut name and url when adding a shortcut with test case error message added
Signed-off-by: AmbrishRamachandiran <ambrish.r@infosys.com>
This commit is contained in:
@@ -74,15 +74,13 @@ describe('AddShortcut', () => {
|
||||
const spy = jest.spyOn(api, 'add');
|
||||
|
||||
await renderInTestApp(
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[shortcutsApiRef, new DefaultShortcutsApi(MockStorageApi.create())],
|
||||
]}
|
||||
>
|
||||
<AddShortcut {...props} />
|
||||
</TestApiProvider>,
|
||||
),
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[shortcutsApiRef, new DefaultShortcutsApi(MockStorageApi.create())],
|
||||
]}
|
||||
>
|
||||
<AddShortcut {...props} />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
|
||||
const urlInput = screen.getByPlaceholderText('Enter a URL');
|
||||
|
||||
@@ -53,6 +53,12 @@ describe('ShortcutForm', () => {
|
||||
expect(
|
||||
screen.getByText('Must be at least 2 characters'),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('A shortcut with this title already exists'),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('A shortcut with this url already exists'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user