mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
20 lines
511 B
JavaScript
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);
|
|
});
|
|
});
|