@bevel-software/platform-core-frontend 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -202
- package/THIRD-PARTY-NOTICES.md +344 -988
- package/package.json +5 -5
- package/src/core/CoreAppShell.tsx +4 -4
- package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
- package/src/core/__tests__/bootstrap.test.ts +47 -2
- package/src/core/bootstrap.ts +20 -0
- package/src/css-side-effect-imports.d.ts +7 -7
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
- package/src/modules/access/api.ts +5 -5
- package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
- package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
- package/src/modules/layout/components/SidebarFrame.tsx +2 -2
- package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
- package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
- package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
- package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
- package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
- package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
- package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
- package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
- package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
- package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
- package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
- package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
- package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
- package/src/modules/library/__tests__/auth-harness.tsx +4 -4
- package/src/modules/library/__tests__/status.test.ts +19 -19
- package/src/modules/library/__tests__/tools.api.test.ts +70 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
- package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
- package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
- package/src/modules/library/components/LibraryCard.tsx +26 -2
- package/src/modules/library/components/LibraryLayout.tsx +70 -70
- package/src/modules/library/components/LibraryPage.tsx +8 -8
- package/src/modules/library/components/LockGlyph.tsx +1 -1
- package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
- package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
- package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
- package/src/modules/library/components/NewSkillPanel.tsx +5 -5
- package/src/modules/library/components/PageActions.tsx +3 -3
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
- package/src/modules/library/components/PluginExtras.tsx +195 -0
- package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
- package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
- package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
- package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
- package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
- package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
- package/src/modules/library/hooks/useJoinRequests.ts +8 -8
- package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
- package/src/modules/library/routes/library-paths.ts +36 -36
- package/src/modules/library/services/library.api.ts +9 -9
- package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
- package/src/modules/library/services/tools.api.ts +54 -0
- package/src/modules/library/state/library-data.tsx +46 -46
- package/src/modules/library/utils/names.ts +1 -1
- package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
- package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
- package/src/modules/library/utils/status.ts +17 -17
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
- package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
- package/src/modules/review/components/ReviewPanel.tsx +11 -11
- package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
- package/src/modules/settings/components/SettingsLayout.tsx +1 -1
- package/src/modules/settings/components/SettingsNav.tsx +5 -5
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
- package/src/modules/workspace/components/FileExplorer.tsx +12 -12
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +3 -3
- package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
- package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
- package/src/shared/mcp/CopyBlock.tsx +42 -0
- package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
- package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
- package/src/shared/mcp/connect-snippets.ts +353 -0
- package/src/shared/mcp/index.ts +28 -0
- package/src/shared/mcp/useCopyFeedback.ts +46 -0
- package/src/test-setup.ts +11 -0
package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx}
RENAMED
|
@@ -24,10 +24,10 @@ vi.mock('../services/library.api', async (importOriginal) => ({
|
|
|
24
24
|
createEmptySkill: apiMock.createEmptySkill,
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { AddToPluginDialog } from '../components/AddToPluginDialog';
|
|
28
28
|
|
|
29
29
|
const ADD_PROMPT =
|
|
30
|
-
'Help me build a new skill or tool and add it to the GTM
|
|
30
|
+
'Help me build a new skill or tool and add it to the GTM plugin at Bevel. ' +
|
|
31
31
|
'I run it, so it goes in directly. No review step.';
|
|
32
32
|
|
|
33
33
|
function workspace(kbDirName: string | null) {
|
|
@@ -65,7 +65,7 @@ function renderDialog(
|
|
|
65
65
|
) {
|
|
66
66
|
const onClose = vi.fn();
|
|
67
67
|
render(
|
|
68
|
-
<MemoryRouter initialEntries={['/skills-and-tools/
|
|
68
|
+
<MemoryRouter initialEntries={['/skills-and-tools/plugins/GTM']}>
|
|
69
69
|
<AdminContext.Provider value={admin(isAdmin)}>
|
|
70
70
|
<WorkspaceContext.Provider value={workspace(kbDirName)}>
|
|
71
71
|
<LibraryToastProvider>
|
|
@@ -75,9 +75,9 @@ function renderDialog(
|
|
|
75
75
|
<Route
|
|
76
76
|
path="*"
|
|
77
77
|
element={
|
|
78
|
-
<
|
|
78
|
+
<AddToPluginDialog
|
|
79
79
|
name="GTM"
|
|
80
|
-
primaryPath="
|
|
80
|
+
primaryPath="Plugins/GTM"
|
|
81
81
|
canWrite={canWrite}
|
|
82
82
|
existingSkills={existingSkills}
|
|
83
83
|
onClose={onClose}
|
|
@@ -103,14 +103,14 @@ function renderDialog(
|
|
|
103
103
|
|
|
104
104
|
const writeText = vi.fn<(text: string) => Promise<void>>();
|
|
105
105
|
|
|
106
|
-
describe('
|
|
106
|
+
describe('AddToPluginDialog', () => {
|
|
107
107
|
beforeEach(() => {
|
|
108
108
|
writeText.mockReset();
|
|
109
109
|
writeText.mockResolvedValue(undefined);
|
|
110
110
|
apiMock.createEmptySkill.mockReset();
|
|
111
111
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
112
|
-
repoRelativePath: '
|
|
113
|
-
workspacePath: 'knowledge-base/
|
|
112
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
113
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
114
114
|
branch: 'target-company-state',
|
|
115
115
|
direct: true,
|
|
116
116
|
});
|
|
@@ -124,12 +124,12 @@ describe('AddToGroupDialog', () => {
|
|
|
124
124
|
Reflect.deleteProperty(navigator, 'clipboard');
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
it('names the
|
|
127
|
+
it('names the plugin in its title and its lede', () => {
|
|
128
128
|
renderDialog();
|
|
129
129
|
expect(screen.getByRole('heading', { name: 'Add a skill or tool to GTM' })).toBeInTheDocument();
|
|
130
130
|
expect(
|
|
131
131
|
screen.getByText(
|
|
132
|
-
'Two ways in. Either way it joins GTM. Everyone in the
|
|
132
|
+
'Two ways in. Either way it joins GTM. Everyone in the plugin gets it the next time their agent connects.',
|
|
133
133
|
),
|
|
134
134
|
).toBeInTheDocument();
|
|
135
135
|
});
|
|
@@ -164,15 +164,15 @@ describe('AddToGroupDialog', () => {
|
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// ── the first door: a file, not a folder tour ──
|
|
167
|
-
// This half used to navigate to the
|
|
167
|
+
// This half used to navigate to the plugin folder and leave the person there to
|
|
168
168
|
// work out that a skill is a folder with a SKILL.md in it. It now writes the
|
|
169
169
|
// file, so the assertions are about what gets written and where it opens.
|
|
170
|
-
describe('
|
|
170
|
+
describe('AddToPluginDialog: starting an empty SKILL.md', () => {
|
|
171
171
|
beforeEach(() => {
|
|
172
172
|
apiMock.createEmptySkill.mockReset();
|
|
173
173
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
174
|
-
repoRelativePath: '
|
|
175
|
-
workspacePath: 'knowledge-base/
|
|
174
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
175
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
176
176
|
branch: 'target-company-state',
|
|
177
177
|
direct: true,
|
|
178
178
|
});
|
|
@@ -183,17 +183,17 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
183
183
|
expect(create()).toBeDisabled();
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
-
it('creates it in the
|
|
186
|
+
it('creates it in the plugin folder, opens the file, and closes', async () => {
|
|
187
187
|
const { field, create, onClose, href } = renderDialog();
|
|
188
188
|
fireEvent.change(field(), { target: { value: ' weekly-report ' } });
|
|
189
189
|
fireEvent.click(create());
|
|
190
190
|
|
|
191
|
-
// Trimmed, addressed at the
|
|
191
|
+
// Trimmed, addressed at the plugin's own folder, and carrying the writer
|
|
192
192
|
// verdict — the service decides direct-vs-change-request from it.
|
|
193
193
|
await waitFor(() =>
|
|
194
194
|
expect(apiMock.createEmptySkill).toHaveBeenCalledWith(
|
|
195
195
|
expect.objectContaining({
|
|
196
|
-
parentPath: '
|
|
196
|
+
parentPath: 'Plugins/GTM',
|
|
197
197
|
name: 'weekly-report',
|
|
198
198
|
canWrite: true,
|
|
199
199
|
}),
|
|
@@ -205,7 +205,7 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
205
205
|
// rather than silently landing on a read-only page.
|
|
206
206
|
await waitFor(() =>
|
|
207
207
|
// The canonical address: the new SKILL.md's own workspace URL.
|
|
208
|
-
expect(href()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/
|
|
208
|
+
expect(href()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/Plugins/GTM/weekly-report/SKILL.md`),
|
|
209
209
|
);
|
|
210
210
|
expect(screen.getByLabelText('router-state')).toHaveTextContent(
|
|
211
211
|
JSON.stringify({ startEditing: true }),
|
|
@@ -221,7 +221,7 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
221
221
|
expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
-
it('refuses a name another skill already holds, in any
|
|
224
|
+
it('refuses a name another skill already holds, in any plugin', () => {
|
|
225
225
|
// A skill's id IS its name, and the backend's scan drops the second claimant
|
|
226
226
|
// outright — so this file would exist and never appear anywhere.
|
|
227
227
|
const { field, create } = renderDialog('knowledge-base', true, ['rfi', 'weekly-report']);
|
|
@@ -232,28 +232,28 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
232
232
|
|
|
233
233
|
it('surfaces the backend refusal and stays open', async () => {
|
|
234
234
|
apiMock.createEmptySkill.mockRejectedValue(
|
|
235
|
-
new Error("You don't have permission to write to
|
|
235
|
+
new Error("You don't have permission to write to Plugins/GTM"),
|
|
236
236
|
);
|
|
237
237
|
const { field, create, onClose } = renderDialog();
|
|
238
238
|
fireEvent.change(field(), { target: { value: 'weekly-report' } });
|
|
239
239
|
fireEvent.click(create());
|
|
240
240
|
|
|
241
|
-
expect(await screen.findByText(/don't have permission to write to
|
|
241
|
+
expect(await screen.findByText(/don't have permission to write to Plugins\/GTM/)).toBeInTheDocument();
|
|
242
242
|
expect(onClose).not.toHaveBeenCalled();
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
// ── one door, one varying clause ──
|
|
247
|
-
// The
|
|
247
|
+
// The plugin page used to fork on `canWrite` into two different flows. It does
|
|
248
248
|
// not any more: everybody gets THIS dialog, and the only thing role changes is
|
|
249
249
|
// what the prompt says happens next — and, now, where the new file lands.
|
|
250
|
-
describe('
|
|
250
|
+
describe('AddToPluginDialog for an admin non-writer', () => {
|
|
251
251
|
it('offers the same dialog, and tells the truth about review', () => {
|
|
252
252
|
renderDialog('knowledge-base', false);
|
|
253
253
|
expect(
|
|
254
254
|
screen.getByText(/goes to GTM as a change request, and an owner reviews it/),
|
|
255
255
|
).toBeInTheDocument();
|
|
256
|
-
expect(screen.getByText(/send it to the
|
|
256
|
+
expect(screen.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
257
257
|
expect(screen.queryByText(/no review step/)).not.toBeInTheDocument();
|
|
258
258
|
});
|
|
259
259
|
|
|
@@ -265,8 +265,8 @@ describe('AddToGroupDialog for an admin non-writer', () => {
|
|
|
265
265
|
|
|
266
266
|
it('passes the verdict down, so the file goes for review', async () => {
|
|
267
267
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
268
|
-
repoRelativePath: '
|
|
269
|
-
workspacePath: 'knowledge-base/
|
|
268
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
269
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
270
270
|
branch: 'suggestions/juan/weekly-report',
|
|
271
271
|
direct: false,
|
|
272
272
|
});
|
|
@@ -279,35 +279,35 @@ describe('AddToGroupDialog for an admin non-writer', () => {
|
|
|
279
279
|
expect.objectContaining({ canWrite: false }),
|
|
280
280
|
),
|
|
281
281
|
);
|
|
282
|
-
// A proposal has no page yet, so the dialog does NOT navigate — the
|
|
282
|
+
// A proposal has no page yet, so the dialog does NOT navigate — the plugin
|
|
283
283
|
// page stays put, and the new skill appears on it as an "In review" card.
|
|
284
|
-
expect(await screen.findByText(/sent to the
|
|
285
|
-
expect(href()).toBe('/skills-and-tools/
|
|
284
|
+
expect(await screen.findByText(/sent to the plugin's owners for review/)).toBeInTheDocument();
|
|
285
|
+
expect(href()).toBe('/skills-and-tools/plugins/GTM');
|
|
286
286
|
});
|
|
287
287
|
});
|
|
288
288
|
|
|
289
|
-
describe('
|
|
289
|
+
describe('AddToPluginDialog for a non-admin', () => {
|
|
290
290
|
beforeEach(() => {
|
|
291
291
|
apiMock.createEmptySkill.mockClear();
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
it('removes empty skill creation even when the person can write the
|
|
294
|
+
it('removes empty skill creation even when the person can write the plugin', () => {
|
|
295
295
|
renderDialog('knowledge-base', true, [], false);
|
|
296
296
|
|
|
297
297
|
expect(screen.queryByText('Start an empty SKILL.md')).not.toBeInTheDocument();
|
|
298
298
|
expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
|
|
299
299
|
expect(screen.getByRole('button', { name: 'Copy prompt' })).toBeInTheDocument();
|
|
300
|
-
expect(screen.getByText(/add it to GTM for everyone in the
|
|
300
|
+
expect(screen.getByText(/add it to GTM for everyone in the plugin/)).toBeInTheDocument();
|
|
301
301
|
expect(screen.queryByText(/Two ways in/)).not.toBeInTheDocument();
|
|
302
302
|
});
|
|
303
303
|
|
|
304
|
-
it('keeps only the reviewed agent path when the person cannot write the
|
|
304
|
+
it('keeps only the reviewed agent path when the person cannot write the plugin', () => {
|
|
305
305
|
renderDialog('knowledge-base', false, [], false);
|
|
306
306
|
|
|
307
307
|
expect(screen.queryByText('Start an empty SKILL.md')).not.toBeInTheDocument();
|
|
308
308
|
expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
|
|
309
309
|
expect(screen.getByText(/change request for an owner to review/)).toBeInTheDocument();
|
|
310
|
-
expect(screen.getByText(/send it to the
|
|
310
|
+
expect(screen.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
311
311
|
expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
|
|
312
312
|
});
|
|
313
313
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
2
|
import { render, screen, cleanup } from '@testing-library/react';
|
|
3
3
|
import { LibraryCard, type LibraryCardProps } from '../components/LibraryCard';
|
|
4
|
-
import { displayFirstName,
|
|
4
|
+
import { displayFirstName, personalPluginName } from '../utils/personal-plugin';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* What a card says when it has nothing to report, and what it says when it has.
|
|
@@ -13,7 +13,11 @@ import { displayFirstName, personalGroupName } from '../utils/personal-group';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
function card(over: Partial<LibraryCardProps> = {}) {
|
|
16
|
-
|
|
16
|
+
// The cast, not a typed literal: `LibraryCardProps` is a discriminated
|
|
17
|
+
// union on `kind`, and a base-plus-overrides spread cannot be proven to
|
|
18
|
+
// land on one arm. Integration overrides still pass `flavor`, as the union
|
|
19
|
+
// demands of real callers.
|
|
20
|
+
const props = {
|
|
17
21
|
kind: 'skill',
|
|
18
22
|
id: 'rfi',
|
|
19
23
|
name: 'rfi',
|
|
@@ -22,7 +26,7 @@ function card(over: Partial<LibraryCardProps> = {}) {
|
|
|
22
26
|
status: { state: 'ok', text: 'Ready' },
|
|
23
27
|
onOpen: vi.fn(),
|
|
24
28
|
...over,
|
|
25
|
-
};
|
|
29
|
+
} as LibraryCardProps;
|
|
26
30
|
render(<LibraryCard {...props} />);
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -32,10 +36,24 @@ describe('LibraryCard', () => {
|
|
|
32
36
|
expect(screen.queryByText(/^Skill$/i)).not.toBeInTheDocument();
|
|
33
37
|
|
|
34
38
|
cleanup();
|
|
35
|
-
card({ kind: 'integration', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
39
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
36
40
|
expect(screen.queryByText(/^Integration$/i)).not.toBeInTheDocument();
|
|
37
41
|
});
|
|
38
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The one label an integration DOES carry: how it is declared, because that
|
|
45
|
+
* decides which file an owner edits. Required by the props union — an
|
|
46
|
+
* optional here shipped cards silently missing the badge.
|
|
47
|
+
*/
|
|
48
|
+
it('says how an integration is declared', () => {
|
|
49
|
+
card({ kind: 'integration', flavor: 'mcp', id: 'linear', name: 'linear', status: { state: 'ok', text: 'Connected' } });
|
|
50
|
+
expect(screen.getByText('MCP server')).toBeInTheDocument();
|
|
51
|
+
|
|
52
|
+
cleanup();
|
|
53
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
54
|
+
expect(screen.getByText('UTCP manual')).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
|
|
39
57
|
it('says nothing about a healthy skill', () => {
|
|
40
58
|
card({ kind: 'skill', status: { state: 'ok', text: 'Ready' } });
|
|
41
59
|
// Not even "Ready": a green word on every skill in the grid is a row of
|
|
@@ -49,12 +67,13 @@ describe('LibraryCard', () => {
|
|
|
49
67
|
});
|
|
50
68
|
|
|
51
69
|
it('always states a tool’s connection, either way', () => {
|
|
52
|
-
card({ kind: 'integration', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
70
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
53
71
|
expect(screen.getByText('Connected')).toBeInTheDocument();
|
|
54
72
|
|
|
55
73
|
cleanup();
|
|
56
74
|
card({
|
|
57
75
|
kind: 'integration',
|
|
76
|
+
flavor: 'utcp',
|
|
58
77
|
id: 'notion',
|
|
59
78
|
name: 'notion',
|
|
60
79
|
status: { state: 'warn', text: 'Needs your sign-in' },
|
|
@@ -116,17 +135,17 @@ describe('LibraryCard', () => {
|
|
|
116
135
|
});
|
|
117
136
|
});
|
|
118
137
|
|
|
119
|
-
describe('
|
|
138
|
+
describe('personalPluginName', () => {
|
|
120
139
|
it('uses the first name, as a colleague would say it out loud', () => {
|
|
121
|
-
expect(
|
|
122
|
-
expect(
|
|
140
|
+
expect(personalPluginName('Juan Viera')).toBe("Juan's Plugin");
|
|
141
|
+
expect(personalPluginName('juan')).toBe("Juan's Plugin");
|
|
123
142
|
});
|
|
124
143
|
|
|
125
144
|
it('still names the place when nobody is signed in', () => {
|
|
126
145
|
// The space exists either way and still needs a heading — and "Yours" is
|
|
127
146
|
// true for whoever is reading it.
|
|
128
|
-
expect(
|
|
129
|
-
expect(
|
|
147
|
+
expect(personalPluginName(null)).toBe('Yours');
|
|
148
|
+
expect(personalPluginName(' ')).toBe('Yours');
|
|
130
149
|
});
|
|
131
150
|
});
|
|
132
151
|
|
|
@@ -140,7 +159,7 @@ describe('displayFirstName', () => {
|
|
|
140
159
|
});
|
|
141
160
|
|
|
142
161
|
// Empty rather than a fallback, because the two callers want different
|
|
143
|
-
// words for it — "Yours" on the
|
|
162
|
+
// words for it — "Yours" on the plugin heading, "there" on the welcome page.
|
|
144
163
|
it('gives nothing back when there is no name, and lets the caller decide', () => {
|
|
145
164
|
expect(displayFirstName(null)).toBe('');
|
|
146
165
|
expect(displayFirstName(undefined)).toBe('');
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { AdminContext } from '../../admin/state/admin.context';
|
|
11
11
|
import type { LibraryData } from '../hooks/useLibraryData';
|
|
12
12
|
import type { ToolSecrets } from '../../secrets-vault/services/tool-secrets.api';
|
|
13
|
-
import type {
|
|
13
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
14
14
|
import type { ToolPageState } from '../hooks/useToolPage';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -24,22 +24,22 @@ import type { ToolPageState } from '../hooks/useToolPage';
|
|
|
24
24
|
const dataMock = vi.hoisted(() => ({ useLibraryData: vi.fn() }));
|
|
25
25
|
vi.mock('../hooks/useLibraryData', () => ({ useLibraryData: dataMock.useLibraryData }));
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const pluginsMock = vi.hoisted(() => ({
|
|
28
|
+
listPlugins: vi.fn(),
|
|
29
29
|
listJoinRequests: vi.fn(),
|
|
30
30
|
}));
|
|
31
|
-
vi.mock('../services/
|
|
32
|
-
|
|
33
|
-
listJoinRequests:
|
|
31
|
+
vi.mock('../services/plugins.api', () => ({
|
|
32
|
+
listPlugins: pluginsMock.listPlugins,
|
|
33
|
+
listJoinRequests: pluginsMock.listJoinRequests,
|
|
34
34
|
reconcileJoinRequest: vi.fn(),
|
|
35
|
-
|
|
35
|
+
requestPluginAccess: vi.fn(),
|
|
36
36
|
AlreadyReadableError: class AlreadyReadableError extends Error {},
|
|
37
37
|
}));
|
|
38
38
|
|
|
39
39
|
const toolPageMock = vi.hoisted(() => ({ useToolPage: vi.fn() }));
|
|
40
40
|
vi.mock('../hooks/useToolPage', () => ({ useToolPage: toolPageMock.useToolPage }));
|
|
41
41
|
|
|
42
|
-
// ManageAccessDialog (reachable from the
|
|
42
|
+
// ManageAccessDialog (reachable from the plugin page's Share) fetches through
|
|
43
43
|
// this module. Nothing opens it in a routing test, but the stub keeps any
|
|
44
44
|
// accidental mount from waiting on a refused connection.
|
|
45
45
|
vi.mock('../../access/api', async (importOriginal) => {
|
|
@@ -67,7 +67,7 @@ import { withAuth, TEST_PERSONAL_GROUP } from './auth-harness';
|
|
|
67
67
|
const tool = (over: Partial<ToolSecrets>): ToolSecrets => ({
|
|
68
68
|
slug: 'heyreach',
|
|
69
69
|
name: 'heyreach',
|
|
70
|
-
path: '
|
|
70
|
+
path: 'Plugins/GTM/heyreach.tool',
|
|
71
71
|
type: 'inline',
|
|
72
72
|
setup: null,
|
|
73
73
|
canWrite: false,
|
|
@@ -79,9 +79,9 @@ const CATALOG: LibraryData = {
|
|
|
79
79
|
loading: false,
|
|
80
80
|
error: null,
|
|
81
81
|
skills: [
|
|
82
|
-
{ name: 'outreach', description: 'Runs the GTM outreach.', path: '
|
|
83
|
-
{ name: 'roadmap', description: 'Keeps the roadmap.', path: '
|
|
84
|
-
{ name: 'scratch', description: 'A skill in no
|
|
82
|
+
{ name: 'outreach', description: 'Runs the GTM outreach.', path: 'Plugins/GTM/outreach' },
|
|
83
|
+
{ name: 'roadmap', description: 'Keeps the roadmap.', path: 'Plugins/Product/roadmap' },
|
|
84
|
+
{ name: 'scratch', description: 'A skill in no plugin.', path: 'Skills/scratch' },
|
|
85
85
|
],
|
|
86
86
|
pendingSkills: [],
|
|
87
87
|
tools: [
|
|
@@ -96,10 +96,10 @@ const CATALOG: LibraryData = {
|
|
|
96
96
|
reload: vi.fn(),
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
const
|
|
99
|
+
const PLUGINS: PluginSummary[] = [
|
|
100
100
|
{
|
|
101
101
|
name: 'GTM',
|
|
102
|
-
folders: ['
|
|
102
|
+
folders: ['Plugins/GTM'],
|
|
103
103
|
canRead: true,
|
|
104
104
|
canWrite: true,
|
|
105
105
|
isOwner: false,
|
|
@@ -135,7 +135,7 @@ function LocationProbe() {
|
|
|
135
135
|
/**
|
|
136
136
|
* The shell's providers, which the Library sits inside for real
|
|
137
137
|
* (`CoreAppShell` mounts both above every app surface). The tool page reads
|
|
138
|
-
* `isAdmin` and `kbDirName` from them; the locked-
|
|
138
|
+
* `isAdmin` and `kbDirName` from them; the locked-plugin and request surfaces
|
|
139
139
|
* read `kbDirName` to address `access.md`.
|
|
140
140
|
*/
|
|
141
141
|
function wrap(children: ReactNode) {
|
|
@@ -181,17 +181,17 @@ const pathname = () => screen.getByLabelText('pathname').textContent;
|
|
|
181
181
|
describe('LibraryRoutes', () => {
|
|
182
182
|
beforeEach(() => {
|
|
183
183
|
dataMock.useLibraryData.mockReturnValue(CATALOG);
|
|
184
|
-
|
|
184
|
+
pluginsMock.listPlugins.mockResolvedValue(PLUGINS);
|
|
185
185
|
toolPageMock.useToolPage.mockReturnValue(TOOL_PAGE_STATE);
|
|
186
|
-
|
|
186
|
+
pluginsMock.listJoinRequests.mockResolvedValue([]);
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
-
it('opens on the all-
|
|
189
|
+
it('opens on the all-plugins index at /skills-and-tools', async () => {
|
|
190
190
|
renderAt('/skills-and-tools');
|
|
191
191
|
expect(
|
|
192
|
-
await screen.findByRole('heading', { name: 'All
|
|
192
|
+
await screen.findByRole('heading', { name: 'All plugins', level: 1 }),
|
|
193
193
|
).toBeInTheDocument();
|
|
194
|
-
expect(screen.getByRole('button', { name: /^All
|
|
194
|
+
expect(screen.getByRole('button', { name: /^All plugins/ })).toHaveAttribute(
|
|
195
195
|
'aria-current',
|
|
196
196
|
'true',
|
|
197
197
|
);
|
|
@@ -222,7 +222,7 @@ describe('LibraryRoutes', () => {
|
|
|
222
222
|
expect(screen.getByRole('button', { name: /^Owned by me/ })).toHaveAttribute('aria-current', 'true');
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
it("/skills-and-tools/yours is the caller's own
|
|
225
|
+
it("/skills-and-tools/yours is the caller's own plugin, as a plugin page", async () => {
|
|
226
226
|
renderAt('/skills-and-tools/yours');
|
|
227
227
|
expect(
|
|
228
228
|
await screen.findByRole('heading', { name: TEST_PERSONAL_GROUP, level: 1 }),
|
|
@@ -231,21 +231,21 @@ describe('LibraryRoutes', () => {
|
|
|
231
231
|
'aria-current',
|
|
232
232
|
'true',
|
|
233
233
|
);
|
|
234
|
-
// The
|
|
234
|
+
// The plugin-page furniture, not a filtered gallery: sections and a trail.
|
|
235
235
|
expect(screen.getByRole('heading', { name: 'Skills', level: 2 })).toBeInTheDocument();
|
|
236
236
|
expect(screen.getByRole('heading', { name: 'Tools', level: 2 })).toBeInTheDocument();
|
|
237
237
|
expect(screen.getByRole('navigation', { name: 'Breadcrumb' })).toBeInTheDocument();
|
|
238
238
|
});
|
|
239
239
|
|
|
240
|
-
it('a
|
|
241
|
-
// Membership is what puts a
|
|
242
|
-
// the member rows from catalog items alone made a freshly created
|
|
240
|
+
it('a plugin you are in appears in the nav even when it is EMPTY', async () => {
|
|
241
|
+
// Membership is what puts a plugin in your MCP; content is not. Deriving
|
|
242
|
+
// the member rows from catalog items alone made a freshly created plugin
|
|
243
243
|
// vanish from the very list headed "Included in your MCP".
|
|
244
|
-
|
|
245
|
-
...
|
|
244
|
+
pluginsMock.listPlugins.mockResolvedValue([
|
|
245
|
+
...PLUGINS,
|
|
246
246
|
{
|
|
247
247
|
name: 'Fresh',
|
|
248
|
-
folders: ['
|
|
248
|
+
folders: ['Plugins/Fresh'],
|
|
249
249
|
canRead: true,
|
|
250
250
|
canWrite: true,
|
|
251
251
|
skillCount: 0,
|
|
@@ -258,32 +258,32 @@ describe('LibraryRoutes', () => {
|
|
|
258
258
|
},
|
|
259
259
|
]);
|
|
260
260
|
renderAt('/skills-and-tools');
|
|
261
|
-
const nav = await screen.findByRole('navigation', { name: 'Library
|
|
261
|
+
const nav = await screen.findByRole('navigation', { name: 'Library plugins' });
|
|
262
262
|
// In the member half, with a zero count — never below the gap as locked.
|
|
263
263
|
expect(await within(nav).findByRole('button', { name: /^Fresh/ })).toBeInTheDocument();
|
|
264
264
|
expect(within(nav).queryByRole('button', { name: 'Fresh (locked)' })).toBeNull();
|
|
265
265
|
});
|
|
266
266
|
|
|
267
|
-
it('a sidebar
|
|
267
|
+
it('a sidebar plugin click navigates to /skills-and-tools/plugins/<name>', async () => {
|
|
268
268
|
renderAt('/skills-and-tools');
|
|
269
269
|
fireEvent.click(await screen.findByRole('button', { name: /^GTM/ }));
|
|
270
|
-
await waitFor(() => expect(pathname()).toBe('/skills-and-tools/
|
|
271
|
-
// The
|
|
270
|
+
await waitFor(() => expect(pathname()).toBe('/skills-and-tools/plugins/GTM'));
|
|
271
|
+
// The plugin page itself lands in a later work package; the ROUTE resolves
|
|
272
272
|
// now, which is why the sidebar can already point at it.
|
|
273
273
|
expect(screen.getByRole('button', { name: /^GTM/ })).toHaveAttribute('aria-current', 'true');
|
|
274
|
-
expect(screen.queryByRole('heading', { name: 'All
|
|
274
|
+
expect(screen.queryByRole('heading', { name: 'All plugins', level: 1 })).not.toBeInTheDocument();
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
-
it('sends the old /
|
|
278
|
-
renderAt('/skills-and-tools/
|
|
277
|
+
it('sends the old /plugins index path home, where the index lives now', async () => {
|
|
278
|
+
renderAt('/skills-and-tools/plugins');
|
|
279
279
|
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
280
280
|
expect(
|
|
281
|
-
await screen.findByRole('heading', { name: 'All
|
|
281
|
+
await screen.findByRole('heading', { name: 'All plugins', level: 1 }),
|
|
282
282
|
).toBeInTheDocument();
|
|
283
283
|
});
|
|
284
284
|
|
|
285
|
-
it("a
|
|
286
|
-
renderAt('/skills-and-tools/
|
|
285
|
+
it("a plugin deep link renders that plugin's cards and no others", async () => {
|
|
286
|
+
renderAt('/skills-and-tools/plugins/GTM');
|
|
287
287
|
expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
|
|
288
288
|
expect(screen.getByTestId('library-card-skill-outreach')).toBeInTheDocument();
|
|
289
289
|
expect(screen.getByTestId('library-card-integration-heyreach')).toBeInTheDocument();
|
|
@@ -293,50 +293,75 @@ describe('LibraryRoutes', () => {
|
|
|
293
293
|
// `/propose` was retired with the role fork it served. An unknown path under
|
|
294
294
|
// the Library falls back to the root, which is what this now asserts.
|
|
295
295
|
it('sends the retired propose path back home', async () => {
|
|
296
|
-
renderAt('/skills-and-tools/propose?
|
|
296
|
+
renderAt('/skills-and-tools/propose?plugin=GTM');
|
|
297
297
|
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
-
it("reaches the index from a
|
|
301
|
-
renderAt('/skills-and-tools/
|
|
302
|
-
fireEvent.click(await screen.findByRole('link', { name: 'All
|
|
300
|
+
it("reaches the index from a plugin page breadcrumb, at the root it lives at", async () => {
|
|
301
|
+
renderAt('/skills-and-tools/plugins/GTM');
|
|
302
|
+
fireEvent.click(await screen.findByRole('link', { name: 'All plugins' }));
|
|
303
303
|
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
304
304
|
expect(
|
|
305
|
-
await screen.findByRole('heading', { name: 'All
|
|
305
|
+
await screen.findByRole('heading', { name: 'All plugins', level: 1 }),
|
|
306
306
|
).toBeInTheDocument();
|
|
307
307
|
});
|
|
308
308
|
|
|
309
|
-
it('leads the sidebar with All
|
|
310
|
-
renderAt('/skills-and-tools/
|
|
311
|
-
const
|
|
312
|
-
expect(
|
|
313
|
-
fireEvent.click(
|
|
309
|
+
it('leads the sidebar with All plugins, from anywhere in the Library', async () => {
|
|
310
|
+
renderAt('/skills-and-tools/plugins/GTM');
|
|
311
|
+
const allPlugins = await screen.findByRole('button', { name: /^All plugins/ });
|
|
312
|
+
expect(allPlugins).toHaveAttribute('aria-current', 'false');
|
|
313
|
+
fireEvent.click(allPlugins);
|
|
314
314
|
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
315
|
-
expect(screen.getByRole('button', { name: /^All
|
|
315
|
+
expect(screen.getByRole('button', { name: /^All plugins/ })).toHaveAttribute(
|
|
316
316
|
'aria-current',
|
|
317
317
|
'true',
|
|
318
318
|
);
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
it('a
|
|
321
|
+
it('a plugin deep link with a URL-hostile name round-trips', async () => {
|
|
322
322
|
dataMock.useLibraryData.mockReturnValue({
|
|
323
323
|
...CATALOG,
|
|
324
|
-
skills: [{ name: 'pricing', description: '', path: '
|
|
324
|
+
skills: [{ name: 'pricing', description: '', path: 'Plugins/Sales & Ops/pricing' }],
|
|
325
325
|
tools: [],
|
|
326
326
|
});
|
|
327
|
-
renderAt(`/skills-and-tools/
|
|
327
|
+
renderAt(`/skills-and-tools/plugins/${encodeURIComponent('Sales & Ops')}`);
|
|
328
328
|
await waitFor(() =>
|
|
329
329
|
expect(screen.getByRole('button', { name: /^Sales & Ops/ })).toHaveAttribute('aria-current', 'true'),
|
|
330
330
|
);
|
|
331
331
|
});
|
|
332
332
|
|
|
333
|
+
it('redirects a legacy /groups/:plugin deep link to the plugin page', async () => {
|
|
334
|
+
// The pre-rename URL shape. Links to it exist in the wild; without the
|
|
335
|
+
// alias the `*` fallback would send them home instead of to the plugin.
|
|
336
|
+
renderAt('/skills-and-tools/groups/GTM');
|
|
337
|
+
await waitFor(() => expect(pathname()).toBe('/skills-and-tools/plugins/GTM'));
|
|
338
|
+
expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('redirects a legacy /groups link with a URL-hostile name, encoding intact', async () => {
|
|
342
|
+
dataMock.useLibraryData.mockReturnValue({
|
|
343
|
+
...CATALOG,
|
|
344
|
+
skills: [{ name: 'pricing', description: '', path: 'Plugins/Sales & Ops/pricing' }],
|
|
345
|
+
tools: [],
|
|
346
|
+
});
|
|
347
|
+
renderAt(`/skills-and-tools/groups/${encodeURIComponent('Sales & Ops')}`);
|
|
348
|
+
await waitFor(() =>
|
|
349
|
+
expect(pathname()).toBe(`/skills-and-tools/plugins/${encodeURIComponent('Sales & Ops')}`),
|
|
350
|
+
);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('sends the legacy /groups index home, like /plugins', async () => {
|
|
354
|
+
renderAt('/skills-and-tools/groups');
|
|
355
|
+
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
356
|
+
});
|
|
357
|
+
|
|
333
358
|
it('/skills-and-tools/tools/:slug redirects to the canonical workspace URL, hash intact', async () => {
|
|
334
359
|
// The legacy address is the OAuth callback's landing target, so the
|
|
335
360
|
// redirect must carry the `#…` outcome fragment to the canonical page.
|
|
336
361
|
renderAt('/skills-and-tools/tools/heyreach#authorized');
|
|
337
362
|
await waitFor(() =>
|
|
338
363
|
expect(pathname()).toBe(
|
|
339
|
-
`/workspace/${DEFAULT_BRANCH}/knowledge-base/
|
|
364
|
+
`/workspace/${DEFAULT_BRANCH}/knowledge-base/Plugins/GTM/heyreach.tool#authorized`,
|
|
340
365
|
),
|
|
341
366
|
);
|
|
342
367
|
});
|
|
@@ -345,7 +370,7 @@ describe('LibraryRoutes', () => {
|
|
|
345
370
|
renderAt('/skills-and-tools/skills/outreach');
|
|
346
371
|
await waitFor(() =>
|
|
347
372
|
expect(pathname()).toBe(
|
|
348
|
-
`/workspace/${DEFAULT_BRANCH}/knowledge-base/
|
|
373
|
+
`/workspace/${DEFAULT_BRANCH}/knowledge-base/Plugins/GTM/outreach/SKILL.md`,
|
|
349
374
|
),
|
|
350
375
|
);
|
|
351
376
|
});
|
|
@@ -355,7 +380,7 @@ describe('LibraryRoutes', () => {
|
|
|
355
380
|
fireEvent.click(await screen.findByRole('button', { name: /^heyreach/ }));
|
|
356
381
|
|
|
357
382
|
await waitFor(() =>
|
|
358
|
-
expect(pathname()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/
|
|
383
|
+
expect(pathname()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/Plugins/GTM/heyreach.tool`),
|
|
359
384
|
);
|
|
360
385
|
expect(screen.queryByRole('dialog')).toBeNull();
|
|
361
386
|
});
|
|
@@ -364,15 +389,15 @@ describe('LibraryRoutes', () => {
|
|
|
364
389
|
renderAt('/skills-and-tools/nope');
|
|
365
390
|
await waitFor(() => expect(pathname()).toBe('/skills-and-tools'));
|
|
366
391
|
expect(
|
|
367
|
-
await screen.findByRole('heading', { name: 'All
|
|
392
|
+
await screen.findByRole('heading', { name: 'All plugins', level: 1 }),
|
|
368
393
|
).toBeInTheDocument();
|
|
369
394
|
});
|
|
370
395
|
|
|
371
|
-
it('renders the gallery even when the
|
|
372
|
-
|
|
396
|
+
it('renders the gallery even when the plugins endpoint fails', async () => {
|
|
397
|
+
pluginsMock.listPlugins.mockRejectedValue(new Error("Couldn't load plugins."));
|
|
373
398
|
renderAt('/skills-and-tools/everything');
|
|
374
399
|
expect(await screen.findByRole('heading', { name: 'Everything', level: 1 })).toBeInTheDocument();
|
|
375
|
-
// Sidebar
|
|
400
|
+
// Sidebar plugins are catalog-derived, so they survive the endpoint being down.
|
|
376
401
|
expect(screen.getByRole('button', { name: /^GTM/ })).toBeInTheDocument();
|
|
377
402
|
});
|
|
378
403
|
});
|