L
L
lightseeker2020-12-13 23:03:49
JavaScript
lightseeker, 2020-12-13 23:03:49

How to check for changes to an external entity in JEST?

const obj = { a: 1 };
expect(someFunction(obj)) // Как проверить изменения obj?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WbICHA, 2020-12-13
@lightseeker

const obj = { a: 1 };
const expectedObj = { a: 2 };

someFunction(obj);

expect(obj).toEqual(expectedObj);

----------------------
someFunction(JSON.parse(JSON.stringify(obj)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question