0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 05:28:35 +00:00
renovatebot_renovate/lib/config/defaults.spec.ts
2023-11-07 15:50:29 +00:00

46 lines
1.2 KiB
TypeScript

import { getDefault } from './defaults';
import type { RenovateOptions } from './types';
describe('config/defaults', () => {
describe('getDefault()', () => {
it('returns new instances of arrays when called repeatedly', () => {
const option: RenovateOptions = {
type: 'array',
description: 'thing',
name: 'thing',
};
const array1 = getDefault(option);
const array2 = getDefault(option);
// Equal values, different objects
expect(array2).toEqual(array2);
expect(array1).not.toBe(array2);
});
it('returns true for boolean values', () => {
const option: RenovateOptions = {
type: 'boolean',
description: 'thing',
name: 'thing',
};
const val = getDefault(option);
expect(val).toBe(true);
});
it.each(['string', 'object', 'integer'])(
'returns null for %s values',
(type: string) => {
const option: RenovateOptions = {
type: type as 'string' | 'object' | 'integer',
description: 'thing',
name: 'thing',
};
const val = getDefault(option);
expect(val).toBeNull();
},
);
});
});