UNPKG

mutiple

Version:

A SDK for monitoring browser and miniPrograme errors

23 lines (21 loc) 697 B
import { options, setTraceId } from '@mutiple/core' import { _support } from '@mutiple/utils' describe('options.ts', () => { it('should setTraceId func work', () => { options.bindOptions({ includeHttpUrlTraceIdRegExp: /cjh/, enableTraceId: true }) let testIsRun = false setTraceId('http://www.test.com/a/b', (headerFieldName: string, traceId: string) => { testIsRun = true }) expect(testIsRun).toBeFalsy() let cjhIsRun = false setTraceId('http://www.cjh.com/a/b', (headerFieldName: string, traceId: string) => { cjhIsRun = true expect(headerFieldName).toBe(options.traceIdFieldName) }) expect(cjhIsRun).toBeTruthy() }) })