Files
renovate/lib/util/coerce.spec.ts
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

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);
});
});
});