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 40b0be0a
authored
Mar 10, 2014
by
Thanasis Polychronakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust tests for built-in validators check
1 parent
737b921f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
test/dao.validations.test.js
test/dao.validations.test.js
View file @
40b0be0
...
@@ -202,7 +202,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -202,7 +202,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
failingUser
.
validate
().
done
(
function
(
err
,
_errors
)
{
failingUser
.
validate
().
done
(
function
(
err
,
_errors
)
{
expect
(
_errors
).
to
.
not
.
be
.
null
expect
(
_errors
).
to
.
not
.
be
.
null
expect
(
_errors
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
_errors
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
_errors
.
name
).
to
.
deep
.
eql
([
message
]
)
expect
(
_errors
.
name
[
0
].
message
).
to
.
equal
(
message
)
done
()
done
()
})
})
})
})
...
@@ -231,7 +231,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -231,7 +231,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
expect
(
arguments
).
to
.
have
.
length
(
0
)
expect
(
arguments
).
to
.
have
.
length
(
0
)
done
()
done
()
}).
error
(
function
(
err
)
{
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
deep
.
equal
({})
expect
(
err
).
to
.
deep
.
equal
({})
done
()
done
()
})
})
})
})
...
@@ -302,7 +302,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -302,7 +302,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
Model
.
create
({
name
:
'World'
}).
success
(
function
(
model
)
{
Model
.
create
({
name
:
'World'
}).
success
(
function
(
model
)
{
model
.
updateAttributes
({
name
:
''
}).
error
(
function
(
err
)
{
model
.
updateAttributes
({
name
:
''
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
name
).
to
.
deep
.
equal
([
'Validation notEmpty failed'
]
);
expect
(
err
.
name
[
0
].
message
).
to
.
equal
(
'Validation notEmpty failed'
);
done
()
done
()
})
})
})
})
...
@@ -321,10 +321,10 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -321,10 +321,10 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
})
})
Model
.
sync
({
force
:
true
}).
success
(
function
()
{
Model
.
sync
({
force
:
true
}).
success
(
function
()
{
Model
.
create
({
name
:
'World'
}).
success
(
function
(
model
)
{
Model
.
create
({
name
:
'World'
}).
success
(
function
()
{
Model
.
update
({
name
:
''
},
{
id
:
1
}).
error
(
function
(
err
)
{
Model
.
update
({
name
:
''
},
{
id
:
1
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
name
).
to
.
deep
.
equal
([
'Validation notEmpty failed'
]
)
expect
(
err
.
name
[
0
].
message
).
to
.
equal
(
'Validation notEmpty failed'
)
done
()
done
()
})
})
})
})
...
@@ -401,7 +401,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -401,7 +401,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
id
:
'helloworld'
}).
error
(
function
(
err
)
{
User
.
create
({
id
:
'helloworld'
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
id
).
to
.
deep
.
equal
([
'Validation isInt failed'
]
)
expect
(
err
.
id
[
0
].
message
).
to
.
equal
(
'Validation isInt failed'
)
done
()
done
()
})
})
})
})
...
@@ -422,7 +422,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -422,7 +422,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
username
:
'helloworldhelloworld'
}).
error
(
function
(
err
)
{
User
.
create
({
username
:
'helloworldhelloworld'
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
username
).
to
.
deep
.
equal
([
'Username must be an integer!'
]
)
expect
(
err
.
username
[
0
].
message
).
to
.
equal
(
'Username must be an integer!'
)
done
()
done
()
})
})
})
})
...
@@ -449,7 +449,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -449,7 +449,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
it
(
'should emit an error when we try to enter in a string for the id key with validation arguments'
,
function
(
done
)
{
it
(
'should emit an error when we try to enter in a string for the id key with validation arguments'
,
function
(
done
)
{
this
.
User
.
create
({
id
:
'helloworld'
}).
error
(
function
(
err
)
{
this
.
User
.
create
({
id
:
'helloworld'
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
id
).
to
.
deep
.
equal
([
'ID must be an integer!'
]
)
expect
(
err
.
id
[
0
].
message
).
to
.
equal
(
'ID must be an integer!'
)
done
()
done
()
})
})
})
})
...
@@ -459,7 +459,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -459,7 +459,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
user
.
validate
().
success
(
function
(
err
)
{
user
.
validate
().
success
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
id
).
to
.
deep
.
equal
([
'ID must be an integer!'
]
)
expect
(
err
.
id
[
0
].
message
).
to
.
equal
(
'ID must be an integer!'
)
done
()
done
()
})
})
})
})
...
@@ -468,7 +468,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -468,7 +468,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
var
user
=
this
.
User
.
build
({
id
:
'helloworld'
})
var
user
=
this
.
User
.
build
({
id
:
'helloworld'
})
user
.
save
().
error
(
function
(
err
)
{
user
.
save
().
error
(
function
(
err
)
{
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
err
.
id
).
to
.
deep
.
equal
([
'ID must be an integer!'
]
)
expect
(
err
.
id
[
0
].
message
).
to
.
equal
(
'ID must be an integer!'
)
done
()
done
()
})
})
})
})
...
@@ -574,7 +574,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -574,7 +574,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
.
success
(
function
(
error
)
{
.
success
(
function
(
error
)
{
expect
(
error
).
not
.
to
.
be
.
null
expect
(
error
).
not
.
to
.
be
.
null
expect
(
error
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
error
).
to
.
be
.
an
.
instanceOf
(
Error
)
expect
(
error
.
age
).
to
.
deep
.
equal
([
"must be positive"
]
)
expect
(
error
.
age
[
0
].
message
).
to
.
equal
(
"must be positive"
)
User
.
build
({
age
:
null
}).
validate
().
success
(
function
()
{
User
.
build
({
age
:
null
}).
validate
().
success
(
function
()
{
User
.
build
({
age
:
1
}).
validate
().
success
(
function
()
{
User
.
build
({
age
:
1
}).
validate
().
success
(
function
()
{
...
@@ -700,7 +700,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -700,7 +700,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
failingBar
.
validate
().
success
(
function
(
errors
)
{
failingBar
.
validate
().
success
(
function
(
errors
)
{
expect
(
errors
).
not
.
to
.
be
.
null
expect
(
errors
).
not
.
to
.
be
.
null
expect
(
errors
.
field
).
to
.
have
.
length
(
1
)
expect
(
errors
.
field
).
to
.
have
.
length
(
1
)
expect
(
errors
.
field
[
0
]
).
to
.
equal
(
"Validation isIn failed"
)
expect
(
errors
.
field
[
0
].
message
).
to
.
equal
(
"Validation isIn failed"
)
})
})
})
})
...
...
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