Updated plugin to be addProperty Re #132

This commit is contained in:
David Coomber 2023-03-22 20:56:35 +02:00
parent d21e7f6fb5
commit 5c15438949

View File

@ -8,7 +8,7 @@ const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser }
const { expect } = chai; const { expect } = chai;
chai.use(function (chai, utils) { chai.use(function (chai, utils) {
// Custom assertion for checking if a variable is JSON // Custom assertion for checking if a variable is JSON
chai.Assertion.addMethod('json', function () { chai.Assertion.addProperty('json', function () {
const obj = this._obj; const obj = this._obj;
const isJson = typeof obj === 'object' && obj !== null && !Array.isArray(obj) && obj.constructor === Object; const isJson = typeof obj === 'object' && obj !== null && !Array.isArray(obj) && obj.constructor === Object;