mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-30 22:37:24 +00:00
28 lines
639 B
TypeScript
28 lines
639 B
TypeScript
|
import { fingerprint } from './fingerprint';
|
||
|
|
||
|
describe('util/fingerprint', () => {
|
||
|
const obj: any = {
|
||
|
name: 'object',
|
||
|
type: 'object',
|
||
|
isObject: true,
|
||
|
};
|
||
|
|
||
|
const obj2: any = {
|
||
|
type: 'object',
|
||
|
name: 'object',
|
||
|
isObject: true,
|
||
|
};
|
||
|
|
||
|
it('returns empty string', () => {
|
||
|
const res = fingerprint(undefined);
|
||
|
expect(res).toBeEmptyString();
|
||
|
});
|
||
|
|
||
|
it('maintains deterministic order', () => {
|
||
|
const res = fingerprint(obj);
|
||
|
const res2 = fingerprint(obj2);
|
||
|
expect(res).not.toEqual(JSON.stringify(obj)); // shows that safeStringify changes the original order
|
||
|
expect(res).toEqual(res2);
|
||
|
});
|
||
|
});
|