Hey! I’m completely new to the world of testing an...
# graphql-nexus
s
Hey! I’m completely new to the world of testing and I just looked into
jest
. Is there a reason why in the Nexus Documentation they’re using Snapshot testing instead of just using
expect(result).toEqual(exampleResult)
? Is it just for convenience or is there something that I’m missing?
d
Hi Shreyas, yes, snapshot testing is faster and more convenient as it will check against the previous state and error if the snapshot does not match. Developers can overwrite this though so anyone working on the code must not overwrite blindly. Asserting equality is safer but requires more effort to write and maintain as the values change.
💯 1
s
Ahh okay, thank you!
I can see how maintaining the return value for every case can become a problem