Snapshot testas nusako (angl. "snapshot") tam tikrą išvestį (dažniausiai UI komponento renderuotą išvestį arba duomenų struktūrą) ir lygina būsimus vykdymus su juo — pažymėdamas, kai išvestis pasikeičia. Tai naudinga nesumantiems pokyčiams nustatyti, tačiau turi apribojimų, kuriuos reikia suprasti.
Kaip snapshot testas veikia
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).();
});
