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 c7ab9968
authored
Nov 13, 2014
by
Jarkko Mönkkönen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Promisify tests
1 parent
6906e2a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
test/dao-factory.test.js
test/dao-factory.test.js
View file @
c7ab996
...
@@ -353,13 +353,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -353,13 +353,13 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
bCol
:
{
type
:
Sequelize
.
STRING
,
unique
:
'a_and_b'
}
bCol
:
{
type
:
Sequelize
.
STRING
,
unique
:
'a_and_b'
}
})
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
bind
(
this
).
then
(
function
()
{
User
.
create
({
username
:
'tobi'
,
email
:
'tobi@tobi.me'
}).
success
(
function
()
{
return
self
.
sequelize
.
Promise
.
all
([
User
.
create
({
username
:
'tobi'
,
email
:
'tobi@tobi.me'
})
.
catch
(
self
.
sequelize
.
UniqueConstraintError
,
function
(
err
)
{
User
.
create
({
username
:
'tobi'
,
email
:
'tobi@tobi.me'
})
,
expect
(
err
.
message
).
to
.
equal
(
'User and email must be unique'
)
User
.
create
({
username
:
'tobi'
,
email
:
'tobi@tobi.me'
})]
)
done
()
}).
catch
(
self
.
sequelize
.
UniqueConstraintError
,
function
(
err
)
{
}
)
expect
(
err
.
message
).
to
.
equal
(
'User and email must be unique'
)
}
)
done
(
)
})
})
})
})
...
@@ -382,18 +382,18 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -382,18 +382,18 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
}]
}]
});
});
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
bind
(
this
).
then
(
function
()
{
// Redefine the model to use the index in database and override error message
// Redefine the model to use the index in database and override error message
User
=
self
.
sequelize
.
define
(
'UserWithUniqueUsername'
,
{
User
=
self
.
sequelize
.
define
(
'UserWithUniqueUsername'
,
{
user_id
:
{
type
:
Sequelize
.
INTEGER
,
unique
:
{
name
:
'user_and_email_index'
,
msg
:
'User and email must be unique'
}},
user_id
:
{
type
:
Sequelize
.
INTEGER
,
unique
:
{
name
:
'user_and_email_index'
,
msg
:
'User and email must be unique'
}},
email
:
{
type
:
Sequelize
.
STRING
,
unique
:
'user_and_email_index'
}
email
:
{
type
:
Sequelize
.
STRING
,
unique
:
'user_and_email_index'
}
});
});
User
.
create
({
user_id
:
1
,
email
:
'tobi@tobi.me'
}).
success
(
function
()
{
return
self
.
sequelize
.
Promise
.
all
([
User
.
create
({
user_id
:
1
,
email
:
'tobi@tobi.me'
})
.
catch
(
self
.
sequelize
.
UniqueConstraintError
,
function
(
err
)
{
User
.
create
({
user_id
:
1
,
email
:
'tobi@tobi.me'
})
,
expect
(
err
.
message
).
to
.
equal
(
'User and email must be unique'
)
User
.
create
({
user_id
:
1
,
email
:
'tobi@tobi.me'
})]
)
done
()
}).
catch
(
self
.
sequelize
.
UniqueConstraintError
,
function
(
err
)
{
}
)
expect
(
err
.
message
).
to
.
equal
(
'User and email must be unique'
)
}
)
done
(
)
})
})
})
})
...
...
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