Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 78d1f617
authored
Mar 30, 2011
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for on('failure', ...)
1 parent
62dfc1a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
lib/sequelize/query.js
test/Model/sync.js
lib/sequelize/query.js
View file @
78d1f61
...
@@ -22,6 +22,7 @@ Query.prototype.run = function(query) {
...
@@ -22,6 +22,7 @@ Query.prototype.run = function(query) {
client
.
query
(
query
,
function
(
err
,
results
,
fields
)
{
client
.
query
(
query
,
function
(
err
,
results
,
fields
)
{
err
?
self
.
onFailure
(
err
)
:
self
.
onSuccess
(
query
,
results
,
fields
)
err
?
self
.
onFailure
(
err
)
:
self
.
onSuccess
(
query
,
results
,
fields
)
})
})
client
.
on
(
'error'
,
function
(
err
)
{
self
.
onFailure
(
err
)
})
client
.
end
()
client
.
end
()
return
this
return
this
...
...
test/Model/sync.js
View file @
78d1f61
...
@@ -4,11 +4,19 @@ var assert = require("assert")
...
@@ -4,11 +4,19 @@ var assert = require("assert")
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
)
module
.
exports
=
{
module
.
exports
=
{
'sync should work'
:
function
(
beforeExit
)
{
'sync should work
with correct database config
'
:
function
(
beforeExit
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
var
User
=
sequelize
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
bio
:
Sequelize
.
TEXT
})
})
User
.
sync
().
on
(
'success'
,
beforeExit
)
User
.
sync
().
on
(
'success'
,
beforeExit
)
},
'sync should fail with incorrect database config'
:
function
(
beforeExit
)
{
var
s
=
new
Sequelize
(
'foo'
,
'bar'
,
null
)
var
User
=
s
.
define
(
'User'
,
{
name
:
Sequelize
.
STRING
,
bio
:
Sequelize
.
TEXT
})
User
.
sync
().
on
(
'failure'
,
beforeExit
)
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment