Files
sim/apps/sim/lib/workflows/search-replace/subflow-fields.test.ts
T
WaleedandVikhyath Mondreti 57f00e2a96 fix(table): fix table boolean, add dynamic row number col size, search & replace imporvements (#4515)
* fix(table): fix table boolean, add dynamic row number col size, fix style for search and replace

* sidebar styling

* refactor(search-replace): extract duplicate WORKFLOW_SEARCH_HIGHLIGHT_CLASS to shared constants

* fix(tables): add missing onError toast to useAddTableColumn

* fix(tables): add consistent onError toast handlers across all table mutations

* subblock sweep

* more resources supported

* code restructuring

* better organization

* canonical modes search replace counterpart

* more cases

* tool inp edge case

* more subblock cases

* trigger canoncial index ops consolidation

* minor codec fix

* fix(tables): prevent double toast in workflow-sidebar and csv upload mutations

* resolver fix for quoted js literals

* code scan context

* triple quotes case

* escaped behaviour

---------

Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
2026-05-08 10:39:36 -07:00

35 lines
1.0 KiB
TypeScript

/**
* @vitest-environment node
*/
import { describe, expect, it } from 'vitest'
import {
WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS,
workflowSearchSubflowFieldMatchesExpected,
} from '@/lib/workflows/search-replace/subflow-fields'
describe('workflowSearchSubflowFieldMatchesExpected', () => {
it('detects stale loop and parallel field values before replace apply', () => {
expect(
workflowSearchSubflowFieldMatchesExpected(
{ type: 'loop', data: { loopType: 'for', count: 5 } },
WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS.iterations,
'5'
)
).toBe(true)
expect(
workflowSearchSubflowFieldMatchesExpected(
{ type: 'loop', data: { loopType: 'for', count: 10 } },
WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS.iterations,
'5'
)
).toBe(false)
expect(
workflowSearchSubflowFieldMatchesExpected(
{ type: 'parallel', data: { parallelType: 'collection', collection: '{{items}}' } },
WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS.items,
'{{items}}'
)
).toBe(true)
})
})