Skip to content

Commit dddd642

Browse files
committed
test(blocks): handle trigger-advanced mode in canonical validation tests
1 parent 2180127 commit dddd642

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

apps/sim/blocks/blocks.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ describe.concurrent('Blocks Module', () => {
423423
})
424424

425425
it('should have valid mode values for subBlocks', () => {
426-
const validModes = ['basic', 'advanced', 'both', 'trigger', undefined]
426+
const validModes = ['basic', 'advanced', 'both', 'trigger', 'trigger-advanced', undefined]
427427
const blocks = getAllBlocks()
428428
for (const block of blocks) {
429429
for (const subBlock of block.subBlocks) {
@@ -669,7 +669,9 @@ describe.concurrent('Blocks Module', () => {
669669
for (const block of blocks) {
670670
// Exclude trigger-mode subBlocks — they operate in a separate rendering context
671671
// and their IDs don't participate in canonical param resolution
672-
const nonTriggerSubBlocks = block.subBlocks.filter((sb) => sb.mode !== 'trigger')
672+
const nonTriggerSubBlocks = block.subBlocks.filter(
673+
(sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced'
674+
)
673675
const allSubBlockIds = new Set(nonTriggerSubBlocks.map((sb) => sb.id))
674676
const canonicalParamIds = new Set(
675677
nonTriggerSubBlocks.filter((sb) => sb.canonicalParamId).map((sb) => sb.canonicalParamId)
@@ -795,6 +797,8 @@ describe.concurrent('Blocks Module', () => {
795797
>()
796798

797799
for (const subBlock of block.subBlocks) {
800+
// Skip trigger-mode subBlocks — they operate in a separate rendering context
801+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') continue
798802
if (subBlock.canonicalParamId) {
799803
if (!canonicalGroups.has(subBlock.canonicalParamId)) {
800804
canonicalGroups.set(subBlock.canonicalParamId, [])
@@ -861,7 +865,7 @@ describe.concurrent('Blocks Module', () => {
861865
continue
862866
}
863867
// Skip trigger-mode subBlocks — they operate in a separate rendering context
864-
if (subBlock.mode === 'trigger') {
868+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') {
865869
continue
866870
}
867871
const conditionKey = serializeCondition(subBlock.condition)
@@ -895,8 +899,11 @@ describe.concurrent('Blocks Module', () => {
895899
if (!block.inputs) continue
896900

897901
// Find all canonical groups (subBlocks with canonicalParamId)
902+
// Skip trigger-mode subBlocks — they operate in a separate rendering context
903+
// and are not wired to the block's inputs section
898904
const canonicalGroups = new Map<string, string[]>()
899905
for (const subBlock of block.subBlocks) {
906+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') continue
900907
if (subBlock.canonicalParamId) {
901908
if (!canonicalGroups.has(subBlock.canonicalParamId)) {
902909
canonicalGroups.set(subBlock.canonicalParamId, [])
@@ -948,8 +955,10 @@ describe.concurrent('Blocks Module', () => {
948955
.replace(/\/\*[\s\S]*?\*\//g, '') // Remove multi-line comments
949956

950957
// Find all canonical groups (subBlocks with canonicalParamId)
958+
// Skip trigger-mode subBlocks — they are not passed through params function
951959
const canonicalGroups = new Map<string, string[]>()
952960
for (const subBlock of block.subBlocks) {
961+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') continue
953962
if (subBlock.canonicalParamId) {
954963
if (!canonicalGroups.has(subBlock.canonicalParamId)) {
955964
canonicalGroups.set(subBlock.canonicalParamId, [])
@@ -995,8 +1004,11 @@ describe.concurrent('Blocks Module', () => {
9951004

9961005
for (const block of blocks) {
9971006
// Find all canonical groups (subBlocks with canonicalParamId)
1007+
// Skip trigger-mode subBlocks — they operate in a separate rendering context
1008+
// and may have different required semantics from their block counterparts
9981009
const canonicalGroups = new Map<string, typeof block.subBlocks>()
9991010
for (const subBlock of block.subBlocks) {
1011+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') continue
10001012
if (subBlock.canonicalParamId) {
10011013
if (!canonicalGroups.has(subBlock.canonicalParamId)) {
10021014
canonicalGroups.set(subBlock.canonicalParamId, [])

0 commit comments

Comments
 (0)