From 433288347d60d8703994f8da3d2b60a39c1715e7 Mon Sep 17 00:00:00 2001 From: AmbrishRamachandiran Date: Mon, 31 Jul 2023 10:12:05 +0530 Subject: [PATCH] Limit the use of the same shortcut name and url when adding a shortcut with test case error message added Signed-off-by: AmbrishRamachandiran --- plugins/shortcuts/src/AddShortcut.test.tsx | 16 +++++++--------- plugins/shortcuts/src/ShortcutForm.test.tsx | 6 ++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/shortcuts/src/AddShortcut.test.tsx b/plugins/shortcuts/src/AddShortcut.test.tsx index 958e963a3e..35f37bc265 100644 --- a/plugins/shortcuts/src/AddShortcut.test.tsx +++ b/plugins/shortcuts/src/AddShortcut.test.tsx @@ -74,15 +74,13 @@ describe('AddShortcut', () => { const spy = jest.spyOn(api, 'add'); await renderInTestApp( - await renderInTestApp( - - - , - ), + + + , ); const urlInput = screen.getByPlaceholderText('Enter a URL'); diff --git a/plugins/shortcuts/src/ShortcutForm.test.tsx b/plugins/shortcuts/src/ShortcutForm.test.tsx index 773c5491da..8eda30e1ae 100644 --- a/plugins/shortcuts/src/ShortcutForm.test.tsx +++ b/plugins/shortcuts/src/ShortcutForm.test.tsx @@ -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(); }); });