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

Commit d85d38ef by Lachèze Alexandre

Boolean SQLite test (test for ##149)

1 parent 2fa0ddb8
Showing with 25 additions and 2 deletions
...@@ -22,7 +22,8 @@ describe('DAOFactory', function() { ...@@ -22,7 +22,8 @@ describe('DAOFactory', function() {
User = sequelize.define('User', { User = sequelize.define('User', {
age: Sequelize.INTEGER, age: Sequelize.INTEGER,
name: Sequelize.STRING, name: Sequelize.STRING,
bio: Sequelize.TEXT bio: Sequelize.TEXT,
is_admin : Sequelize.BOOLEAN
}) })
Helpers.sync() Helpers.sync()
}) })
...@@ -40,7 +41,7 @@ describe('DAOFactory', function() { ...@@ -40,7 +41,7 @@ describe('DAOFactory', function() {
it('creates a table entry', function() { it('creates a table entry', function() {
Helpers.async(function(done) { Helpers.async(function(done) {
User User
.create({ age: 21, name: 'John Wayne', bio: 'noot noot' }) .create({ age: 21, name: 'John Wayne', bio: 'noot noot'})
.success(done) .success(done)
.error(function(err) { console.log(err) }) .error(function(err) { console.log(err) })
}) })
...@@ -77,6 +78,28 @@ describe('DAOFactory', function() { ...@@ -77,6 +78,28 @@ describe('DAOFactory', function() {
}) })
}) })
}) })
it('should allow the creation of an object with a boolean 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) {
var options = JSON.stringify({ foo: 'bar', bar: 'foo' })
Helpers.Factories.DAO('Person', {
name: 'John Doe',
has_swag: true
}, function(people) {
expect(people.has_swag).toBeTruthy()
done()
})
})
})
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!