Add custom system builder and simulated endpoints

This commit is contained in:
2026-11-05 22:42:27 +00:00
parent 36111a3166
commit e056837232
5 changed files with 54 additions and 10 deletions
+11 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { demoLandscape, getPreset, systemFromPreset, validateLandscape } from './model'
import { definitionFromCapabilities, demoLandscape, getPreset, systemFromPreset, validateLandscape } from './model'
describe('landscape model', () => {
it('provides the editable demo landscape', () => {
@@ -29,4 +29,14 @@ describe('landscape model', () => {
expect(failed.retryStepId).toBe('retry-3')
expect(failed.recoveryStepId).toBe('retry-4')
})
it('creates shared action and endpoint definitions without sharing instance state', () => {
const preset = getPreset('website')!
const definition = definitionFromCapabilities(preset.capabilities)
expect(definition.actions.length).toBeGreaterThan(0)
expect(definition.endpoints.length).toBeGreaterThan(0)
const instance = systemFromPreset({ ...preset, definition }, ['contact-forms'], [10, 20])
expect(instance.definition?.actions[0].outputs[0].payload).toBe(preset.capabilities[0].actions[0].payload)
instance.definition!.actions[0].outputs[0].payload = '{"edited":true}'
expect(definition.actions[0].outputs[0].payload).not.toBe('{"edited":true}')
})
})