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

Commit 02d24381 by dgf

document sqlite errors for quoted data like JSON

1 parent 38135327
Showing with 45 additions and 0 deletions
......@@ -671,6 +671,51 @@ describe('DAOFactory', function() {
})
})
})
describe('handle quoted data', function() {
it('saves data with single quote', function() {
setup({ data: {type: Sequelize.STRING} })
var quote = "single'quote"
Helpers.async(function(done) {
User.create({ data: quote}).success(function(user) {
expect(user.data).toEqual(quote, 'memory single quote')
User.find({where: { id: user.id }}).success(function(user) {
expect(user.data).toEqual(quote, 'SQL single quote')
done()
})
})
})
})
it('saves data with double quote', function() {
setup({ data: {type: Sequelize.STRING} })
var quote = 'double"quote'
Helpers.async(function(done) {
User.create({ data: quote}).success(function(user) {
expect(user.data).toEqual(quote, 'memory double quote')
User.find({where: { id: user.id }}).success(function(user) {
expect(user.data).toEqual(quote, 'SQL double quote')
done()
})
})
})
})
it('saves stringified JSON data', function() {
setup({ data: {type: Sequelize.STRING} })
var json = JSON.stringify({ key: 'value' })
Helpers.async(function(done) {
User.create({ data: json}).success(function(user) {
expect(user.data).toEqual(json, 'memory data')
User.find({where: { id: user.id }}).success(function(user) {
expect(user.data).toEqual(json, 'SQL data')
done()
})
})
})
})
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!