DEV Community

Adizbek Ergashev
Adizbek Ergashev

Posted on

1

Testing API's JSON response with chai

Sometimes we need to validate our API's response if it correctly returning JSON structure.

We may unintended add some secret fields to JSON response such as passwords, tokens.

To be aware of this we should test the JSON response if does it matches our need.

I've wrote chai plugin which helps to test JSON structures with ease.

image

https://github.com/Adizbek/chai-json-validation

Please rate my work and leave comments below about plugin

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more