graphql-validity
Version:
Make business logic validation easy on the graphql side without adding any declarations or modifications to the existing graphql schema.
44 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const sinon = require("sinon");
const profiling_1 = require("../src/profiling");
const hapi_middleware_1 = require("../src/hapi-middleware");
const mocks_1 = require("./helpers/mocks");
const validation = require("../src/validation");
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
var expect = chai.expect;
describe('hapi-middleware', () => {
let profilingResultHandler = {
handler: profiling_1.defaultProfilingResultHandler
};
let server;
let result;
let applyValidationFake;
let sandbox;
beforeEach(() => {
server = {
ext: () => { }
};
applyValidationFake = sinon.fake();
const mockValidation = mocks_1.mockModule(validation, {
applyValidation: applyValidationFake
});
sandbox = sinon.createSandbox();
mockValidation(sandbox);
result = hapi_middleware_1.default(profilingResultHandler);
});
afterEach(() => {
sandbox.restore();
});
it('should return wrapper function', () => {
expect(result).to.be.an('function');
});
describe('graphQLValidityHapiMiddleware', () => {
it('should not throw', () => {
expect(result).to.not.throw(server);
});
});
});
//# sourceMappingURL=hapi-middleware.js.map