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

Commit b427cc96 by Sascha Depold

moved spec into more generic place + added another test

1 parent 593c382e
Showing with 34 additions and 14 deletions
...@@ -98,4 +98,38 @@ describe("[" + Helpers.getTestDialectTeaser() + "] DAO", function() { ...@@ -98,4 +98,38 @@ describe("[" + Helpers.getTestDialectTeaser() + "] DAO", function() {
expect(JSON.parse(JSON.stringify(user))).toEqual({ username: 'test.user', age: 99, isAdmin: true, id: null }) expect(JSON.parse(JSON.stringify(user))).toEqual({ username: 'test.user', age: 99, isAdmin: true, id: null })
}) })
}) })
describe('findAll', function findAll() {
it("escapes a single single quotes properly in where clauses", function(done) {
var self = this
this.User
.create({ username: "user'name" })
.success(function() {
self.User.findAll({
where: { username: "user'name" }
}).success(function(users) {
expect(users.length).toEqual(1)
expect(users[0].username).toEqual("user'name")
done()
})
})
})
it("escapes two single quotes properly in where clauses", function(done) {
var self = this
this.User
.create({ username: "user''name" })
.success(function() {
self.User.findAll({
where: { username: "user''name" }
}).success(function(users) {
expect(users.length).toEqual(1)
expect(users[0].username).toEqual("user''name")
done()
})
})
})
})
}) })
...@@ -48,20 +48,6 @@ if (dialect === 'sqlite') { ...@@ -48,20 +48,6 @@ if (dialect === 'sqlite') {
console.log(err) console.log(err)
}) })
}) })
it("escapes strings properly in where clauses", function(done) {
var self = this
this.User
.create({ username: "user'name" })
.success(function(user) {
self.User.findAll({
where: { username: "user'name" }
}).success(function(users) {
expect(users.length).toEqual(1)
done()
})
})
})
}) })
}) })
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!