@@ -86,11 +86,7 @@ describe('EditShortcut', () => {
|
||||
|
||||
fireEvent.click(screen.getByText('Remove'));
|
||||
await waitFor(() => {
|
||||
expect(spy).toBeCalledWith({
|
||||
id: 'id',
|
||||
title: 'some title',
|
||||
url: '/some-url',
|
||||
});
|
||||
expect(spy).toBeCalledWith('id');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export const EditShortcut = ({ shortcut, onClose, anchorEl, api }: Props) => {
|
||||
|
||||
const handleRemove = async () => {
|
||||
try {
|
||||
await api.remove(shortcut);
|
||||
await api.remove(shortcut.id);
|
||||
alertApi.post({
|
||||
message: `Removed shortcut '${shortcut.title}' from your sidebar`,
|
||||
severity: 'success',
|
||||
|
||||
@@ -39,8 +39,8 @@ export class LocalStoredShortcuts implements ShortcutApi {
|
||||
this.notify();
|
||||
}
|
||||
|
||||
async remove(shortcut: Shortcut) {
|
||||
const shortcuts = this.get().filter(s => s.id !== shortcut.id);
|
||||
async remove(id: string) {
|
||||
const shortcuts = this.get().filter(s => s.id !== id);
|
||||
|
||||
await this.storageApi.set('items', shortcuts);
|
||||
this.notify();
|
||||
|
||||
@@ -36,7 +36,7 @@ export interface ShortcutApi {
|
||||
/**
|
||||
* Removes the shortcut.
|
||||
*/
|
||||
remove(shortcut: Shortcut): Promise<void>;
|
||||
remove(id: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Finds an existing shortcut that matches the ID of the
|
||||
|
||||
Reference in New Issue
Block a user