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 71a0d785
authored
Jul 30, 2013
by
Daniel Durante
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added #create specs for dao-validation tests.
1 parent
321e0444
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
test/dao.validations.test.js
test/dao.validations.test.js
View file @
71a0d78
...
@@ -253,6 +253,58 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -253,6 +253,58 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
}
}
}
}
describe
(
'#create'
,
function
()
{
beforeEach
(
function
(
done
)
{
var
self
=
this
var
Project
=
this
.
sequelize
.
define
(
'Project'
,
{
name
:
{
type
:
Sequelize
.
STRING
,
allowNull
:
false
,
defaultValue
:
'unknown'
,
validate
:
{
isIn
:
[[
'unknown'
,
'hello'
,
'test'
]]
}
}
})
var
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
something
:
Sequelize
.
INTEGER
})
Project
.
hasOne
(
Task
)
Task
.
hasOne
(
Project
)
Project
.
sync
({
force
:
true
}).
success
(
function
()
{
Task
.
sync
({
force
:
true
}).
success
(
function
()
{
self
.
Project
=
Project
self
.
Task
=
Task
done
()
})
})
})
it
(
'correctly validates using create method '
,
function
(
done
)
{
var
self
=
this
this
.
Project
.
create
({}).
success
(
function
(
project
)
{
self
.
Task
.
create
({
something
:
1
}).
success
(
function
(
task
)
{
project
.
setTask
(
task
).
success
(
function
(
task
)
{
expect
(
task
.
ProjectId
).
to
.
not
.
be
.
null
done
()
})
})
})
})
it
(
'correctly throws an error using create method '
,
function
(
done
)
{
var
self
=
this
this
.
Project
.
create
({
name
:
'nope'
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
have
.
ownProperty
(
'name'
)
done
()
})
})
})
it
(
'correctly validates using custom validation methods'
,
function
(
done
)
{
it
(
'correctly validates using custom validation methods'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
+
config
.
rand
(),
{
var
User
=
this
.
sequelize
.
define
(
'User'
+
config
.
rand
(),
{
name
:
{
name
:
{
...
...
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