Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 557ff54b2b435e5f1e789c6a8a4e1bebf2d7deb6 28 lines 835 B view raw
1import { ProxyTracerProvider } from '@opentelemetry/api'; 2 3import SafeTracer from './SafeTracer.js'; 4 5describe('SafeTracer', () => { 6 describe('traced', () => { 7 it('shuold run the underlying function with provided args, propagate return value', () => { 8 const fn = jest.fn<(it: unknown) => number>().mockReturnValue(1); 9 const tracer = new SafeTracer( 10 new ProxyTracerProvider().getTracer('noop'), 11 ); 12 const traced = tracer.traced( 13 { 14 resource: 'test', 15 operation: 'something', 16 attributesFromArgs(args) { 17 // eslint-disable-next-line no-restricted-syntax 18 return { it: JSON.stringify(args) }; 19 }, 20 }, 21 fn, 22 ); 23 24 expect(traced('hello')).toBe(1); 25 expect(fn).toHaveBeenCalledWith('hello'); 26 }); 27 }); 28});