Note: Don't forgot to use
chai.use(require('chai-things'));
// index.spec.ts
const chai = require('chai');
const obj = require('./index');
const expect = chai.expect;
chai.use(require('chai-things'));
describe('array obj test', () => {
it('object type', () => {
expect(typeof obj.data).equal('object');
});
it('object key check', () => {
expect({
status: 200,
data: [{
level: 6,
points: 200,
closing_ratios: 50,
minimum_closing_ratios: 10,
retention: 30
}],
message: 'Data Fetched Successfully successfully'
}).to.have.all.deep.keys('level', 'points', 'closing_ratios', 'minimum_closing_ratios', 'retention');
});
});