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:
AmbrishRamachandiran
2023-07-31 10:12:05 +05:30
parent 900dbea7f7
commit 433288347d
2 changed files with 13 additions and 9 deletions
+7 -9
View File
@@ -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();
});
});