mirror of
https://github.com/renovatebot/renovate.git
synced 2025-03-15 08:34:54 +00:00
![renovate[bot]](/assets/img/avatar_default.png)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
35 lines
691 B
TypeScript
35 lines
691 B
TypeScript
import { assignKeys } from './assign-keys';
|
|
|
|
describe('util/assign-keys', () => {
|
|
it('should assign values from right to left for specified keys', () => {
|
|
interface Left {
|
|
foo: number | string;
|
|
bar: number | boolean;
|
|
baz?: number;
|
|
}
|
|
const left: Left = {
|
|
foo: 'foo',
|
|
bar: false,
|
|
baz: 42,
|
|
};
|
|
|
|
interface Right {
|
|
foo?: number;
|
|
bar?: number;
|
|
baz?: number;
|
|
}
|
|
const right: Right = {
|
|
foo: 1,
|
|
bar: 2,
|
|
baz: 3,
|
|
};
|
|
|
|
const result = assignKeys(left, right, ['foo', 'bar']);
|
|
expect(result).toEqual({
|
|
foo: 1,
|
|
bar: 2,
|
|
baz: 42,
|
|
});
|
|
expect(result).toBe(left);
|
|
});
|
|
});
|