|
1 | 1 | import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
|
2 | 2 |
|
3 |
| -import { mongoIntegration, instrumentMongo, _defaultDbStatementSerializer } from '../../../src/integrations/tracing/mongo'; |
| 3 | +import { |
| 4 | + _defaultDbStatementSerializer, |
| 5 | + instrumentMongo, |
| 6 | + mongoIntegration, |
| 7 | +} from '../../../src/integrations/tracing/mongo'; |
4 | 8 | import { INSTRUMENTED } from '../../../src/otel/instrument';
|
5 | 9 |
|
6 | 10 | jest.mock('@opentelemetry/instrumentation-mongodb');
|
@@ -37,30 +41,30 @@ describe('Mongo', () => {
|
37 | 41 | expect(MongoDBInstrumentation).toHaveBeenCalledTimes(1);
|
38 | 42 | expect(MongoDBInstrumentation).toHaveBeenCalledWith({
|
39 | 43 | responseHook: expect.any(Function),
|
40 |
| - dbStatementSerializer: expect.any(Function) |
| 44 | + dbStatementSerializer: expect.any(Function), |
41 | 45 | });
|
42 | 46 | });
|
43 | 47 |
|
44 | 48 | describe('_defaultDbStatementSerializer', () => {
|
45 | 49 | it('rewrites strings as ?', () => {
|
46 | 50 | const serialized = _defaultDbStatementSerializer({
|
47 |
| - find: 'foo' |
| 51 | + find: 'foo', |
48 | 52 | });
|
49 | 53 | expect(JSON.parse(serialized).find).toBe('?');
|
50 | 54 | });
|
51 | 55 |
|
52 | 56 | it('rewrites nested strings as ?', () => {
|
53 | 57 | const serialized = _defaultDbStatementSerializer({
|
54 | 58 | find: {
|
55 |
| - inner: 'foo' |
56 |
| - } |
| 59 | + inner: 'foo', |
| 60 | + }, |
57 | 61 | });
|
58 | 62 | expect(JSON.parse(serialized).find.inner).toBe('?');
|
59 | 63 | });
|
60 | 64 |
|
61 | 65 | it('rewrites Buffer as ?', () => {
|
62 | 66 | const serialized = _defaultDbStatementSerializer({
|
63 |
| - find: Buffer.from('foo', 'utf8') |
| 67 | + find: Buffer.from('foo', 'utf8'), |
64 | 68 | });
|
65 | 69 | expect(JSON.parse(serialized).find).toBe('?');
|
66 | 70 | });
|
|
0 commit comments