Open
Description
When object attributes are given as parameter to the createMock
function, they are copied instead of referenced. This is unexpected and has the disadvantage, that changes on the original object are not reflected in the mock:
interface TestInterface {
testAttribute: {
id: number
};
}
const test = {
id: 0
};
const testMock = createMock<TestInterface>({testAttribute: test});
test.id = 1;
const finalTest = testMock.testAttribute.id === test.id; // expected true, but is actually false
Metadata
Metadata
Assignees
Labels
No labels