+
+
+ {loading ? (
+
+ ) : (
+ shortcuts?.map(shortcut => (
+
+ ))
+ )}
+
+ );
+};
diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts
new file mode 100644
index 0000000000..7ca457fd39
--- /dev/null
+++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 Spotify AB
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { MockStorageApi } from '@backstage/test-utils';
+import { pageTheme } from '@backstage/theme';
+import { Shortcut } from '../types';
+import { LocalStoredShortcuts } from './LocalStoredShortcuts';
+import { ShortcutApi } from './ShortcutApi';
+
+describe('LocalStoredShortcuts', () => {
+ // eslint-disable-next-line jest/no-done-callback
+ it('should observe shortcuts', async done => {
+ const shortcutApi: ShortcutApi = new LocalStoredShortcuts(
+ MockStorageApi.create(),
+ );
+ const shortcut: Shortcut = { id: 'id', title: 'title', url: '/url' };
+
+ await shortcutApi.add(shortcut);
+ shortcutApi.shortcut$().subscribe(data => {
+ expect(data).toEqual(
+ expect.arrayContaining([{ ...shortcut, id: expect.anything() }]),
+ );
+ done();
+ });
+ });
+
+ it('should add shortcuts with ids', async () => {
+ const storageApi = MockStorageApi.create();
+ const shortcutApi: ShortcutApi = new LocalStoredShortcuts(storageApi);
+ const shortcut: Omit