Skip to content

Commit 0466f27

Browse files
committed
test(automation): the Setup nav carries a Connector Connections item gated on manage_connector_connections (red)
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5986e26 commit 0466f27

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

‎packages/services/service-automation/src/connector-credentials-ui.test.ts‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
* item in Setup's Integrations group, naming the console component
1010
* `automation:connector-credentials` and asking `manage_metadata` — the
1111
* capability every verb of the door asks;
12+
* • ADR-0143 D5: a second item names `automation:connector-connections`, the
13+
* Console page of the connector connection door, and asks that door's own
14+
* organization-scoped `manage_connector_connections`, so an organization
15+
* administrator (who holds it, not `manage_metadata`) sees it;
1216
* • a booted kernel registers it once, after `kernel:ready`;
1317
* • an inert boot (`armRuntime: false`, a one-shot tool) serves no console
1418
* and registers no entry; neither does a kernel with no manifest service,
@@ -17,20 +21,24 @@
1721
import { describe, expect, it } from 'vitest';
1822
import { LiteKernel } from '@objectstack/core';
1923
import { ManifestSchema } from '@objectstack/spec/kernel';
24+
import { PLATFORM_CAPABILITIES } from '@objectstack/spec/security';
2025

2126
import { AutomationServicePlugin } from './plugin.js';
2227
import {
2328
CONNECTOR_CREDENTIALS_COMPONENT_REF,
2429
CONNECTOR_CREDENTIALS_NAV_CAPABILITY,
2530
CONNECTOR_CREDENTIALS_UI_BUNDLE,
31+
CONNECTOR_CONNECTIONS_COMPONENT_REF,
32+
CONNECTOR_CONNECTIONS_NAV_CAPABILITY,
2633
} from './connector-credentials-ui.js';
2734

35+
2836
describe('[#27238] the connector credentials UI bundle', () => {
2937
it('is a valid manifest', () => {
3038
expect(() => ManifestSchema.parse(CONNECTOR_CREDENTIALS_UI_BUNDLE)).not.toThrow();
3139
});
3240

33-
it('contributes one Setup → Integrations component item, gated on manage_metadata', () => {
41+
it('contributes two Setup → Integrations component items, each gated on its own door\'s capability', () => {
3442
expect(CONNECTOR_CREDENTIALS_COMPONENT_REF).toBe('automation:connector-credentials');
3543
expect(CONNECTOR_CREDENTIALS_NAV_CAPABILITY).toBe('manage_metadata');
3644
expect(CONNECTOR_CREDENTIALS_UI_BUNDLE.navigationContributions).toEqual([
@@ -47,10 +55,25 @@ describe('[#27238] the connector credentials UI bundle', () => {
4755
icon: 'key-round',
4856
requiredPermissions: ['manage_metadata'],
4957
},
58+
{
59+
id: 'nav_connector_connections',
60+
type: 'component',
61+
label: 'Connector Connections',
62+
componentRef: 'automation:connector-connections',
63+
icon: 'plug',
64+
requiredPermissions: ['manage_connector_connections'],
65+
},
5066
],
5167
},
5268
]);
5369
});
70+
71+
it('the connections item asks the declared organization-scoped capability the connection door enforces', () => {
72+
expect(CONNECTOR_CONNECTIONS_COMPONENT_REF).toBe('automation:connector-connections');
73+
expect(CONNECTOR_CONNECTIONS_NAV_CAPABILITY).toBe('manage_connector_connections');
74+
const declared = PLATFORM_CAPABILITIES.find((c) => c.name === CONNECTOR_CONNECTIONS_NAV_CAPABILITY);
75+
expect(declared?.scope).toBe('org');
76+
});
5477
});
5578

5679
/** Boot a kernel whose `manifest` service (when given) records every registration. */

0 commit comments

Comments
 (0)