mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
30 lines
896 B
TypeScript
30 lines
896 B
TypeScript
import { coerceToNull, coerceToUndefined } from './coerce.ts';
|
|
|
|
describe('util/coerce', () => {
|
|
describe('coerceToNull', () => {
|
|
it('should return null', () => {
|
|
expect(coerceToNull(undefined)).toBeNull();
|
|
expect(coerceToNull(null)).toBeNull();
|
|
});
|
|
|
|
it('should return original value', () => {
|
|
expect(coerceToNull({})).toEqual({});
|
|
expect(coerceToNull('str')).toBe('str');
|
|
expect(coerceToNull(false)).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe('coerceToUndefined', () => {
|
|
it('should return undefined', () => {
|
|
expect(coerceToUndefined(undefined)).toBeUndefined();
|
|
expect(coerceToUndefined(null)).toBeUndefined();
|
|
});
|
|
|
|
it('should return original value', () => {
|
|
expect(coerceToUndefined({})).toEqual({});
|
|
expect(coerceToUndefined('str')).toBe('str');
|
|
expect(coerceToUndefined(false)).toBe(false);
|
|
});
|
|
});
|
|
});
|