diff --git a/src/dk/cvr.spec.ts b/src/dk/cvr.spec.ts index 129603f..541bcd6 100644 --- a/src/dk/cvr.spec.ts +++ b/src/dk/cvr.spec.ts @@ -14,6 +14,12 @@ describe('dk/cvr', () => { expect(result.isValid && result.compact).toEqual('13585628'); }); + test.each(['DK13585628', '13585628', 'DK19319970'])('validate:%s', value => { + const result = validate(value); + + expect(result.isValid).toEqual(true); + }); + it('validate:1234567', () => { const result = validate('1234567'); diff --git a/src/dk/cvr.ts b/src/dk/cvr.ts index 93e72d6..b8e69ca 100644 --- a/src/dk/cvr.ts +++ b/src/dk/cvr.ts @@ -64,7 +64,7 @@ const impl: Validator = { modulus: 11, weights: [2, 7, 6, 5, 4, 3, 2, 1], }); - if (String((11 - sum) % 10) !== check) { + if (String((11 - (sum % 11)) % 11) !== check) { return { isValid: false, error: new exceptions.InvalidChecksum() }; }