diff --git a/src/bg/vat.spec.ts b/src/bg/vat.spec.ts index 4d5d34fd..2ba7e58e 100644 --- a/src/bg/vat.spec.ts +++ b/src/bg/vat.spec.ts @@ -31,4 +31,18 @@ describe('bg/vat', () => { expect(result.error).toBeInstanceOf(InvalidChecksum); }); + + // A registered VAT number starting with 8. The first digit is not + // restricted: python-stdnum's bg/vat has no such rule. + it('validate:BG 831642181', () => { + const result = validate('BG 831642181'); + + expect(result.isValid && result.compact).toEqual('831642181'); + }); + + it('validate:BG 831642182', () => { + const result = validate('BG 831642182'); + + expect(result.error).toBeInstanceOf(InvalidChecksum); + }); }); diff --git a/src/bg/vat.ts b/src/bg/vat.ts index 0da3c8f3..84e334ed 100644 --- a/src/bg/vat.ts +++ b/src/bg/vat.ts @@ -91,10 +91,6 @@ const impl: Validator = { return { isValid: false, error: new exceptions.InvalidFormat() }; } - if (!['0', '1', '2', '3', '9'].includes(value[0])) { - return { isValid: false, error: new exceptions.InvalidFormat() }; - } - if (value.length === 9) { if (!checkLegal(value)) { return { isValid: false, error: new exceptions.InvalidChecksum() };