DEV Community

Discussion on: Clean Code with Unit Tests: Tips and tricks for keeping your test suites clean

Collapse
 
thawkin3 profile image
Tyler Hawkins

Great points. To help with generating consistent pseudo-random data, faker.js actually allows you to provide a seed so that the same results are generated every time.

github.com/marak/Faker.js/#setting...

With that you get the best of both worlds: "Random" data generated for you, but also consistent data used for tests so the same test doesn't randomly fail when different data happens to be generated.