File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ const TestEntity3 = new Entity({
7676 attributes : {
7777 email : { type : 'string' , partitionKey : true } ,
7878 test : { type : 'string' , required : true } ,
79- test2 : { type : 'string' , required : 'always' }
79+ test2 : { type : 'string' , required : 'always' } ,
80+ test3 : { type : 'number' , required : true }
8081 } ,
8182 timestamps : false ,
8283 table : TestTable3
@@ -497,6 +498,15 @@ describe('update',()=>{
497498 expect ( TableName ) . toBe ( 'test-table' )
498499 } )
499500
501+ it ( 'accepts 0 as a valid value for required fields' , ( ) => {
502+ let { ExpressionAttributeValues } = TestEntity3 . updateParams ( {
503+ pk : 'test-pk' ,
504+ test2 : 'test' ,
505+ test3 : 0
506+ } )
507+ expect ( ExpressionAttributeValues ! [ ':test3' ] ) . toBe ( 0 )
508+ } )
509+
500510 it ( 'fails with undefined input' , ( ) => {
501511 expect ( ( ) => TestEntity . updateParams ( ) ) . toThrow ( `'pk' or 'email' is required` )
502512 } )
You can’t perform that action at this time.
0 commit comments