forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoggingMiddlewareTest.ts
28 lines (25 loc) · 1 KB
/
LoggingMiddlewareTest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {serializeLoggingData} from '@libs/Middleware/Logging';
describe('LoggingMiddleware', () => {
describe('getCircularReplacer', () => {
it('should return "[Circular]" for circular references', () => {
const obj: Record<string, unknown> = {};
obj.obj = obj;
const result = serializeLoggingData(obj);
expect(result).toEqual({obj: '[Circular]'});
});
it('should return the original value for non-circular references', () => {
const obj: Record<string, unknown> = {};
obj.foo = 'bar';
const result = serializeLoggingData(obj);
expect(result).toEqual({foo: 'bar'});
});
it('should not stringify function in the object', () => {
const obj: Record<string, unknown> = {
foo: () => 'bar',
baz: 'baz',
};
const result = serializeLoggingData(obj);
expect(result).toEqual({baz: 'baz'});
});
});
});