UNPKG

trade360-nodejs-sdk

Version:

LSports Trade360 SDK for Node.js

19 lines 955 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const validation_error_1 = require("../../../src/entities/errors/validation.error"); const base_error_1 = require("../../../src/entities/errors/base.error"); describe('ValidationError', () => { it('should instantiate with a formatted message', () => { const error = new validation_error_1.ValidationError('saveUser'); expect(error).toBeInstanceOf(validation_error_1.ValidationError); expect(error).toBeInstanceOf(base_error_1.BaseError); expect(error.message).toBe('saveUser validation failed'); expect(error.context).toBeUndefined(); }); it('should assign context if provided', () => { const context = { field: 'email' }; const error = new validation_error_1.ValidationError('updateEmail', context); expect(error.context).toEqual(context); }); }); //# sourceMappingURL=validation.error.spec.js.map