Skip to content

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

TypeScript

test(control-ui): assert Save PUT preserves spec.email

Jose Ramirez4d34c8d1fbc0
diff --git a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
index 6b91d63ba..c601839b1 100644
--- a/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
+++ b/control-ui/components/__tests__/EditCommunicationChannelPage.test.tsx
@@ -919,3 +919,40 @@ describe('EditCommunicationChannelPage conversation delete validation', () => {
expect(api.apiSend).not.toHaveBeenCalled()
})
})
+
+/**
+ * The helper tests round-trip spec.email through the draft builder. They do
+ * not cover the page → request boundary where #386 actually happened: Save
+ * is a full-spec PUT, the edit page has no email controls, and control-api
+ * preserves only credentialsSecretRef. If persistDraft ever built that PUT
+ * without the loaded email groups, the inbox would drop out of the poll set
+ * after an unrelated edit.
+ */
+describe('EditCommunicationChannelPage spec.email preservation on Save', () => {
+ const EMAIL_GROUPS = [{ channelId: 'INBOX', emails: ['[email protected]'] }]
+
+ it('keeps populated spec.email in the PUT when only a modelled field is edited', async () => {
+ mockChannel('inbox-channel', {
+ email: EMAIL_GROUPS,
+ telegram: [{ channelId: '424242', chatType: 'private' }],
+ telegramSettings: { botHandle: '@bot', replyOnlyWhenMentioned: true },
+ })
+ await renderLoadedPage()
+
+ fireEvent.change(screen.getByLabelText(/Telegram bot handle/), {
+ target: { value: '@new_bot' },
+ })
+ fireEvent.click(screen.getByRole('button', { name: 'Save changes' }))
+
+ await waitFor(() => expect(api.apiSend).toHaveBeenCalled())
+ const [method, path, body] = vi.mocked(api.apiSend).mock.calls[0] as [
+ string,
+ string,
+ { spec: { email?: unknown; telegramSettings?: { botHandle?: string } } },
+ ]
+ expect(method).toBe('PUT')
+ expect(path).toBe('/api/v1/admin/communication-channels/inbox-channel')
+ expect(body.spec.email).toEqual(EMAIL_GROUPS)
+ expect(body.spec.telegramSettings?.botHandle).toBe('@new_bot')
+ })
+})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index d5b00a90d..c6c1e8790 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index c5a43e394..bcf1f477a 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",