Files
iD/test/spec/util/rebind.js
2025-02-17 11:35:50 +01:00

20 lines
511 B
JavaScript

describe('utilRebind', () => {
it('copies methods from source to target', () => {
const target = { original: 123 };
const source = new class {
value = 456;
method() {
return this.value;
}
};
const copied = iD.utilRebind(target, source, 'method');
expect(copied).toStrictEqual({
original: 123,
method: expect.any(Function)
});
expect(copied.method()).toBe(456);
});
});