(candidate: StartBlockCandidate<TriggerBlockLike>)
| 176 | } |
| 177 | |
| 178 | function extractEventMockPayload(candidate: StartBlockCandidate<TriggerBlockLike>): unknown { |
| 179 | const triggerId = resolveEventTriggerId(candidate.block) |
| 180 | const sampleRaw = |
| 181 | readSubBlockValue(candidate.block, `samplePayload_${triggerId}`) ?? |
| 182 | readSubBlockValue(candidate.block, 'samplePayload') |
| 183 | |
| 184 | if (typeof sampleRaw === 'string' && sampleRaw.trim()) { |
| 185 | try { |
| 186 | return JSON.parse(sampleRaw) |
| 187 | } catch { |
| 188 | // fall through to generated mock |
| 189 | } |
| 190 | } else if (sampleRaw && typeof sampleRaw === 'object') { |
| 191 | return sampleRaw |
| 192 | } |
| 193 | |
| 194 | return extractTriggerMockPayload(candidate) |
| 195 | } |
| 196 | |
| 197 | function resolveInputKind(path: StartBlockPath, block: TriggerBlockLike): TriggerInputKind { |
| 198 | if (path === StartBlockPath.SPLIT_CHAT) return 'chat' |
no test coverage detected