UNPKG

graphql-validity

Version:

Make business logic validation easy on the graphql side without adding any declarations or modifications to the existing graphql schema.

23 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const helpers_1 = require("../src/helpers"); describe('helpers', () => { describe('onUnhandledError', () => { it('Should mask error', () => { const errorMessage = 'test error message'; const result = helpers_1.onUnhandledError(new Error(errorMessage)); chai_1.expect(result.message).to.not.have.string(errorMessage); chai_1.expect(result.message).to.have.string('An internal error occured'); }); }); describe('ValidityError', () => { it('Should have name and message changed when created', () => { const errorMessage = 'test error message'; const result = new helpers_1.ValidityError(errorMessage); chai_1.expect(result.message).to.have.string('_Validity_' + errorMessage); chai_1.expect(result.name).to.equal('ValidityError'); }); }); }); //# sourceMappingURL=helpers.js.map