Open
Description
Description
nullable
option for @IsNotEmptyObject
but it works the opposite way.
Expected behavior
expected behavior from previous example in #678 is:
class MyClass {
@IsNotEmptyObject()
notStrictModeInvalid = { }; // invalid
@IsNotEmptyObject()
notStrictModeValid = { key1: null, key2: undefined }; // valid
@IsNotEmptyObject({ nullable: false })
strcitModeInvalid = { }; // invalid
@IsNotEmptyObject({ nullable: false })
strcitModeValid = { key1: null, key2: undefined }; // invalid
@IsNotEmptyObject({ nullable: false })
strcitModeValid = { key1: 'key', key2: undefined }; // valid
}
Actual behavior
in the current test suite, there's no test for nullable: false
case.
for nullable: true
testing, null
and undefined
are being treated as invalid values.
here are some tests to prove:
// FAIL
expect(
isNotEmptyObject({ key1: null, key2: undefined }, { nullable: false })
).toBeFalsy()
// FAIL
expect(
isNotEmptyObject({ key1: null, key2: undefined }, { nullable: true })
).toBeTruthy()