UNPKG

amazon-route-53-dns-zone-file

Version:

Makes DNS Zone File easy. Parses and validates BIND zone files and can be extended for custom features. Functionality is modular. Features are made open for extension and closed for runtime mutation. Written in TypeScript.

27 lines (23 loc) 838 B
import { ErrorKeyKind, Validation } from '../../src'; import { Validator } from '../../src'; import { Parser } from '../../src/parser/parser'; describe('Validator', () => { // @note custom validation tested by importAndAdaptAndValidate it('Should be able to extend validation error text', () => { expect.assertions(3); // 2 errors const getErrorText: Validation.GetErrorTextFn = jest.fn( (entry, render): string => { expect(entry.errorType).toEqual(ErrorKeyKind.EmptyInput); return entry.errorType!; } ); const parser = new Parser().setText('').parse(); const { errors } = new Validator({ getErrorText, }).validate(parser); expect(errors).toHaveLength(2); }); it('Should have options as optional', () => { expect(() => new Validator()).not.toThrow(); }); });