Snapshot testing என்பது சில output-ஐ (பொதுவாக UI component-இன் rendered output அல்லது data structure) "snapshot" ஆக capture செய்து, future runs-ஐ அதற்கு எதிராக compare செய்கிறது — output மாறும்போது flag செய்கிறது. Unintended changes-ஐ detect செய்ய useful ஆனால் limitations-ஐ புரிந்துகொள்ள வேண்டியுள்ளது.
Snapshot testing எவ்வாறு செயல்படுகிறது
1. First run → the test RECORDS the output (e.g. a rendered component) as a SNAPSHOT file
2. Later runs → COMPARE the current output to the saved snapshot:
→ MATCHES → pass; DIFFERS → fail (the output changed)
3. If the change is INTENTIONAL → UPDATE the snapshot (review the diff, then accept)
(, {
tree = ().();
(tree).();
});
