不要怂,就是干,撸起袖子干!

Commit adf9836f by sdepold

added test for falsy booleans

1 parent b49c1601
Showing with 25 additions and 4 deletions
......@@ -22,8 +22,9 @@ describe('DAOFactory', function() {
User = sequelize.define('User', {
age: Sequelize.INTEGER,
name: Sequelize.STRING,
bio: Sequelize.TEXT,
bio: Sequelize.TEXT
})
Helpers.sync()
})
......@@ -40,7 +41,7 @@ describe('DAOFactory', function() {
it('creates a table entry', function() {
Helpers.async(function(done) {
User
.create({ age: 21, name: 'John Wayne', bio: 'noot noot'} )
.create({ age: 21, name: 'John Wayne', bio: 'noot noot' })
.success(done)
.error(function(err) { console.log(err) })
})
......@@ -78,7 +79,7 @@ describe('DAOFactory', function() {
})
})
it('should allow the creation of an object with a boolean as attribute', function() {
it('should allow the creation of an object with a boolean (true) as attribute', function() {
var Person = sequelize.define('Person', {
name: Sequelize.STRING,
has_swag: Sequelize.BOOLEAN
......@@ -89,7 +90,6 @@ describe('DAOFactory', function() {
})
Helpers.async(function(done) {
var options = JSON.stringify({ foo: 'bar', bar: 'foo' })
Helpers.Factories.DAO('Person', {
name: 'John Doe',
has_swag: true
......@@ -99,6 +99,27 @@ describe('DAOFactory', function() {
})
})
})
it('should allow the creation of an object with a boolean (false) as attribute', function() {
var Person = sequelize.define('Person', {
name: Sequelize.STRING,
has_swag: Sequelize.BOOLEAN
})
Helpers.async(function(done) {
Person.sync({force: true}).success(done)
})
Helpers.async(function(done) {
Helpers.Factories.DAO('Person', {
name: 'John Doe',
has_swag: false
}, function(people) {
expect(people[0].has_swag).toBeFalsy();
done()
})
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!