test: avoid unsafe optional chaining in GTM provider test

This commit is contained in:
Benjamin Lu
2026-03-31 05:31:28 -07:00
parent 9454c9fdb4
commit b9d7bdf8f2

View File

@@ -140,7 +140,12 @@ describe('GtmTelemetryProvider', () => {
event: 'execution_error',
node_type: 'KSampler'
})
expect((entry?.error as string).length).toBe(100)
const error = entry?.error
expect(typeof error).toBe('string')
if (typeof error !== 'string') {
throw new Error('Expected execution_error payload to include an error')
}
expect(error).toHaveLength(100)
})
it('pushes select_content for template events', () => {