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 def14aac
authored
Mar 11, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unit test that unique constraints are actual errors
1 parent
e43b9db1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
test/dao-factory/create.test.js
test/dao-factory/create.test.js
View file @
def14aa
...
@@ -154,6 +154,32 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -154,6 +154,32 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
})
})
it
(
'should return an error for a unique constraint error'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
'email'
:
{
type
:
DataTypes
.
STRING
,
unique
:
{
name
:
'email'
,
msg
:
'Email is already registered.'
},
validate
:
{
notEmpty
:
true
,
isEmail
:
true
}
}
})
this
.
sequelize
.
sync
({
force
:
true
}).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
User
.
create
({
email
:
'hello@sequelize.com'
}).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
User
.
create
({
email
:
'hello@sequelize.com'
}).
done
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
ok
console
.
log
(
err
)
expect
(
err
).
to
.
be
.
an
.
instanceof
(
Error
)
done
()
})
})
})
})
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
var
self
=
this
var
self
=
this
...
...
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