diff --git a/packages/core/src/V.spec.ts b/packages/core/src/V.spec.ts index 15745d6..c4a793c 100644 --- a/packages/core/src/V.spec.ts +++ b/packages/core/src/V.spec.ts @@ -417,7 +417,12 @@ describe('objects', () => { await expectViolations({ property: 'string' }, validator, defaultViolations.unknownPropertyDenied(ROOT.property('property'))); }); - test('properties', () => expectValid({ foo: 'bar' }, V.properties(V.string(), V.string()))); + describe('properties', () => { + test('valid properties', async () => { + const validator = V.properties(V.string(), V.string()); + (await expectValid({ foo: 'bar' } satisfies Record, validator)) satisfies Record; + }); + }); describe('cross-property rules', () => { interface IPasswordRequest { diff --git a/packages/core/src/V.ts b/packages/core/src/V.ts index d8d9047..2d74a35 100644 --- a/packages/core/src/V.ts +++ b/packages/core/src/V.ts @@ -186,7 +186,8 @@ export const V = { size: (min: number, max: number) => new SizeValidator(min, max), - properties: (keys: Validator, values: Validator) => new ObjectValidator({ additionalProperties: { keys, values } }), + properties: (keys: Validator, values: Validator) => + new ObjectValidator>({ additionalProperties: { keys, values } }), allOf: (...validators: [Validator, ...Validator[]]) => new AllOfValidator(validators), diff --git a/packages/core/src/testUtil.spec.ts b/packages/core/src/testUtil.spec.ts index 6d6d65c..43073fa 100644 --- a/packages/core/src/testUtil.spec.ts +++ b/packages/core/src/testUtil.spec.ts @@ -24,7 +24,7 @@ export function verifyValid(result: ValidationResult, value: any, conv } else { expect(result.getValue()).toEqual(value); } - return result; + return result.getValue(); } test.skip('do not fail build because of no tests found', () => { }); diff --git a/packages/luxon/package.json b/packages/luxon/package.json index 1ca7dbe..3024127 100644 --- a/packages/luxon/package.json +++ b/packages/luxon/package.json @@ -41,7 +41,7 @@ }, "peerDependencies": { "@finnair/path": ">=6", - "@finnair/v-validation": ">=6", + "@finnair/v-validation": ">=7", "luxon": "^3.4.0" }, "devDependencies": { diff --git a/packages/moment/package.json b/packages/moment/package.json index d4364e1..f06b8ed 100644 --- a/packages/moment/package.json +++ b/packages/moment/package.json @@ -41,7 +41,7 @@ }, "peerDependencies": { "@finnair/path": "=>6", - "@finnair/v-validation": ">=6", + "@finnair/v-validation": ">=7", "moment": "^2.30.0" }, "devDependencies": {