Add custom system builder and simulated endpoints
This commit is contained in:
+11
-1
@@ -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}')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user