I'm trying to write a test for a json returned from a promise. I created this simple code so you can try to reproduce:
"use strict";
var chai = require("chai");
chai.should();
var chaiAsPromised = require("chai-as-promised");
var chaiJsonEqual = require('chai-json-equal');
chai.use(chaiAsPromised);
chai.use(chaiJsonEqual);
var expect = chai.expect;
describe('should', function() {
it('return true because its the same json object', function() {
var json = { "foo": "bar" };
return expect(Promise.resolve(json)).to.eventually.jsonEqual(json);
});
});
but i get:
1) should return true because its the same json object:
AssertionError: expected {} to have the same json representation as { foo: 'bar' }
chai-as-promised and chai-json-equal works seperatly, but not together. Do you guys have a solution for this, workaround or other libraries I can use?