graphql-validity
Version:
Make business logic validation easy on the graphql side without adding any declarations or modifications to the existing graphql schema.
27 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const sinon = require("sinon");
const profiling_1 = require("../src/profiling");
describe('profiling', () => {
it('storeProfilingInfo, should add profiling data', () => {
let validity = {
___profilingData: []
};
profiling_1.storeProfilingInfo(validity, 'path', 'profile');
const profilingData = validity.___profilingData;
chai_1.expect(profilingData.length).to.equal(1);
chai_1.expect(profilingData[0].path).to.equal('path');
chai_1.expect(profilingData[0].profile).to.equal('profile');
});
it('defaultProfilingResultHandler, should output to console when profiling data is set', () => {
let spy = sinon.spy(console, 'log');
let profilingData = [];
profiling_1.defaultProfilingResultHandler(profilingData, '0');
chai_1.expect(spy.notCalled).to.be.true;
profilingData.push('test');
profiling_1.defaultProfilingResultHandler(profilingData, '1');
chai_1.expect(spy.calledWith(JSON.stringify(['test'], null, 2))).to.be.true;
});
});
//# sourceMappingURL=profiling.js.map