mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
29 lines
594 B
TypeScript
29 lines
594 B
TypeScript
import { clone } from './clone';
|
|
|
|
describe('util/clone', () => {
|
|
const obj: any = {
|
|
name: 'object',
|
|
type: 'object',
|
|
isObject: true,
|
|
};
|
|
|
|
it('returns null', () => {
|
|
const res = clone(null);
|
|
expect(res).toBeNull();
|
|
});
|
|
|
|
it('maintains same order', () => {
|
|
const res = clone(obj);
|
|
expect(res).toMatchSnapshot(`{
|
|
name: 'object',
|
|
type: 'object',
|
|
isObject: true,
|
|
}`);
|
|
});
|
|
|
|
it('assigns "[Circular]" to circular references', () => {
|
|
obj.circular = obj;
|
|
const res = clone(obj);
|
|
expect(res.circular).toBe('[Circular]');
|
|
});
|
|
});
|