concept data - testid attribute in category svelte

This is an excerpt from Manning's book Svelte and Sapper in Action.
The preceding test simply verifies that the
Item
component renders the expected DOM elements. This can also be accomplished using a “snapshot” test. The first time snapshot tests are run, a_ _snapshots_ _
directory is created, and files containing rendered output are saved in this directory. In subsequent runs the rendered output is compared to these files. Any differences are reported as failed tests.Relying on snapshot tests requires attention to detail on the part of the developers who run them. When tests are run the first time, developers should verify that components are currently rendering correctly. In subsequent test runs, if any tests fail, developers should carefully examine the differences reported and determine whether they are expected based on recent code changes. If they are expected, press the “U” key to update all the snapshot files that differ. Otherwise, fix the errors and rerun the tests.