-
Notifications
You must be signed in to change notification settings - Fork 139
fix(cli): include flows in architecture diffs #3046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -555,6 +555,35 @@ describe('diff', () => { | |
| }); | ||
| }); | ||
|
|
||
| describe('diffArchitectures - flow changes', () => { | ||
| const flow = { | ||
| 'unique-id': 'write-flow', | ||
| name: 'Write flow', | ||
| description: 'Writes a record.', | ||
| transitions: [{ 'relationship-unique-id': 'gateway-to-payment', 'sequence-number': 1, description: 'Write.' }], | ||
| }; | ||
|
|
||
| it('detects added, removed, modified, and unchanged flows', () => { | ||
| const base = { ...testArchitectures.baseArchitecture, flows: [flow] } as CalmArchitectureSchema; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we perhaps create new architectures within
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that fits the existing specs better. I'll move these cases into diff-test-architectures.json, add the flow to the base fixture, and derive the changed case from it. Keeps the test setup consistent with the rest of the file.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with Aman's convention point β worth moving before merge so the flow test cases match the rest of the file. |
||
| const changed = { | ||
| ...base, | ||
| flows: [ | ||
| { ...flow, transitions: [...flow.transitions, { 'relationship-unique-id': 'gateway-to-payment', 'sequence-number': 2, description: 'Confirm.' }] }, | ||
| { ...flow, 'unique-id': 'read-flow', name: 'Read flow' }, | ||
| ], | ||
| } as CalmArchitectureSchema; | ||
| const result = diffArchitectures(base, changed); | ||
| expect(result.flowsAdded.map((item) => item['unique-id'])).toEqual(['read-flow']); | ||
| expect(result.flowsRemoved).toEqual([]); | ||
| expect(result.flowsModified).toHaveLength(1); | ||
| expect(result.flowsModified[0].original['unique-id']).toBe('write-flow'); | ||
| expect(result.flowsSame).toEqual([]); | ||
|
|
||
| const removed = diffArchitectures(base, { ...base, flows: [] }); | ||
| expect(removed.flowsRemoved.map((item) => item['unique-id'])).toEqual(['write-flow']); | ||
| }); | ||
| }); | ||
|
|
||
| describe('diffArchitectures - comprehensive scenarios', () => { | ||
| const empty = (): CalmArchitectureSchema => ({ | ||
| nodes: [], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this is the only composed result interface here without a doc comment (
AdrDiffResult/ControlDiffResultabove both have one).