Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-ui): r8-b1 reproduce duplicate channel action

Josué84b2d3d0edd0
diff --git a/control-ui/components/__tests__/CommunicationChannelsPage.test.tsx b/control-ui/components/__tests__/CommunicationChannelsPage.test.tsx
new file mode 100644
index 000000000..aaa7a47bc
--- /dev/null
+++ b/control-ui/components/__tests__/CommunicationChannelsPage.test.tsx
@@ -0,0 +1,57 @@
+import React from 'react'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { ToastProvider } from '@components/Toast'
+import CommunicationChannelsPage from '../../app/communication-channels/page'
+import * as api from '../../lib/api'
+
+const navigation = vi.hoisted(() => ({ push: vi.fn() }))
+
+vi.mock('next/navigation', () => ({
+ useRouter: () => ({ push: navigation.push }),
+}))
+
+vi.mock('@components/AuthGate', () => ({
+ AuthGate: ({ children }: { children: React.ReactNode }) => <>{children}</>,
+}))
+
+vi.mock('@components/DashboardLayout', () => ({
+ DashboardLayout: ({ children }: { children: React.ReactNode }) => <>{children}</>,
+}))
+
+vi.mock('../../lib/api', async () => {
+ const actual = await vi.importActual<typeof import('../../lib/api')>('../../lib/api')
+ return {
+ ...actual,
+ apiGet: vi.fn(),
+ }
+})
+
+afterEach(() => {
+ cleanup()
+ vi.clearAllMocks()
+})
+
+describe('CommunicationChannelsPage', () => {
+ it('exposes one action for the row detail destination', async () => {
+ vi.mocked(api.apiGet).mockResolvedValue({
+ items: [
+ {
+ metadata: { name: 'channel-a', namespace: 'channels' },
+ spec: { hostRef: 'agent-a' },
+ },
+ ],
+ })
+
+ render(
+ <ToastProvider>
+ <CommunicationChannelsPage />
+ </ToastProvider>
+ )
+
+ fireEvent.click(await screen.findByRole('button', { name: 'Actions for channel channel-a' }))
+
+ expect(screen.getAllByRole('menuitem', { name: 'View details' })).toHaveLength(1)
+ expect(screen.queryByRole('menuitem', { name: 'Edit' })).not.toBeInTheDocument()
+ })
+})
diff --git a/control-ui/components/__tests__/CommunicationChannelsTable.test.tsx b/control-ui/components/__tests__/CommunicationChannelsTable.test.tsx
index b4d4f6b7e..aca2dadd0 100644
--- a/control-ui/components/__tests__/CommunicationChannelsTable.test.tsx
+++ b/control-ui/components/__tests__/CommunicationChannelsTable.test.tsx
@@ -197,7 +197,7 @@ describe('CommunicationChannelsTable — row actions kebab', () => {
} as unknown as CommunicationChannelItem
}
- it('exposes one canonical detail action for the row navigation destination', () => {
+ it('routes the View details menu item through the row navigation handler', () => {
const onOpenChannel = vi.fn()
render(
<ToastProvider>
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 7cd2a55dc..b87550604 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.507",
+ "version": "0.1.508",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.507",
+ "version": "0.1.508",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-table-system": "file:../packages/frontend-table-system",
diff --git a/control-ui/package.json b/control-ui/package.json
index da16977f1..919d21730 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.507",
+ "version": "0.1.508",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",