monastery 1.36.2 → 1.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/validate.js CHANGED
@@ -906,16 +906,18 @@ module.exports = function(monastery, opendb) {
906
906
  },
907
907
  },
908
908
  })
909
-
910
- // Subdocument data (null/string)
911
- await expect(user.validate({ location: null })).rejects.toEqual([{
909
+ let requiredError = [{
912
910
  'detail': 'This field is required.',
913
911
  'meta': {'detailLong': undefined, 'field': 'location', 'model': 'user', 'rule': 'required'},
914
912
  'status': '400',
915
913
  'title': 'location'
916
- }])
914
+ }]
915
+ // required errors
916
+ await expect(user.validate({ location: null })).rejects.toEqual(requiredError)
917
+ await expect(user.validate({ location: '' })).rejects.toEqual(requiredError)
918
+ await expect(user.validate({ location: undefined })).rejects.toEqual(requiredError)
919
+ // required no error
917
920
  await expect(user.validate({ location: {} })).resolves.toEqual({ location: {} })
918
-
919
921
  db.close()
920
922
  })
921
923