codeceptjs-chai
Version:
CodeceptJS helper for chai library
24 lines (12 loc) • 596 B
JavaScript
const { I } = inject();
Feature( 'JSON Schema Validation tests using chai-json-schema-ajv' );
Scenario( 'Successful JSON Schema Validation', async()=>{
const response = await I.sendGetRequest( '/api/users' );
const jsonSchema = require( './users.schema.json' );
I.assertJsonSchemaUsingAJV( response.data, jsonSchema );
} );
Scenario( 'Failed JSON Schema Validation', async()=>{
const response = await I.sendGetRequest( '/api/users' );
const jsonSchema = require( './wrong.schema.json' );
I.assertJsonSchemaUsingAJV( response.data, jsonSchema );
} );