clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

Validate method #110

Closed jkav77 closed 6 years ago

jkav77 commented 6 years ago

I exposed a validate method on the dynogels model to solve #24. So now you can use the model to validate an instance like below. I included some tests and documentation updates. My tests don't cover many permutations so let me know if there is something that doesn't validate through this method.

const Tweet = dynogels.define({
....
})
const tweet = new Tweet({.....})
Tweet.validate(tweet) // returns { error, value }
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.003%) to 98.659% when pulling 85eca705b2b3f9ea46acb9755bd573ecfd68ec25 on dangerginger:validate-method into 6b3f75c123ec1924d70d0ab1178519012c98b079 on clarkie:master.

jkav77 commented 6 years ago

Actually this does not work. I added a failing test and will look at it later.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.003%) to 98.659% when pulling fa0984061f0c74e15c6caba025f264ec1a1a3799 on dangerginger:validate-method into 6b3f75c123ec1924d70d0ab1178519012c98b079 on clarkie:master.

jkav77 commented 6 years ago

Ok I fixed the tests which were not properly passing an Item object to the validate method which caused false positives and negatives. Then I fixed the validation method and it seems to be working now. I think this solves #24 now.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.003%) to 98.659% when pulling 9a95fbccb5229144a3e0615be22416b3786099cc on dangerginger:validate-method into 6b3f75c123ec1924d70d0ab1178519012c98b079 on clarkie:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.007%) to 98.664% when pulling b98988824b03b4b6394a43825654cc9501365cb7 on dangerginger:validate-method into 6b3f75c123ec1924d70d0ab1178519012c98b079 on clarkie:master.