Skip to content

Commit

Permalink
Merge 04f3d43 into 310da5c
Browse files Browse the repository at this point in the history
  • Loading branch information
ecwyne committed Jun 11, 2018
2 parents 310da5c + 04f3d43 commit 6c7b09d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Attribute.js
Expand Up @@ -150,7 +150,7 @@ Attribute.prototype.types = {

Attribute.prototype.setTypeFromRawValue = function(value) {
//no type defined - assume this is not a type definition and we must grab type directly from value
if(!value) {
if(!value && (value === undefined || value === null || isNaN(value))) {
throw new errors.SchemaError('Invalid attribute value: ' + value);
}

Expand Down
9 changes: 9 additions & 0 deletions test/Model.js
Expand Up @@ -528,6 +528,15 @@ describe('Model', function (){
});
});

it('Static Creates new item with unknown fields', function (done) {
Cats.Cat1.create({ id: 666, name: 'Garfield', bool: false }, function (err, garfield) {
should.not.exist(err);
should.exist(garfield);
garfield.bool.should.eql(false);
done();
});
});

it('Static Creates new item with range key', function (done) {
Cats.Cat2.create({ownerId: 666, name: 'Garfield'}, function (err, garfield) {
should.not.exist(err);
Expand Down

0 comments on commit 6c7b09d

Please sign in to comment.