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 338c1e05
authored
Jun 18, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1921 from thanpolas/spaces-on-save
auto-trim-trailing-whitespace
2 parents
f949b7ec
1986e98e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
test/dao.validations.test.js
test/dao.validations.test.js
View file @
338c1e0
...
@@ -570,7 +570,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -570,7 +570,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
User
.
build
({
name
:
"error"
}).
validate
().
success
(
function
(
error
)
{
User
.
build
({
name
:
"error"
}).
validate
().
success
(
function
(
error
)
{
expect
(
error
).
to
.
be
.
an
.
instanceOf
(
self
.
sequelize
.
ValidationError
)
expect
(
error
).
to
.
be
.
an
.
instanceOf
(
self
.
sequelize
.
ValidationError
)
expect
(
error
.
name
[
0
].
message
).
to
.
equal
(
"Invalid username"
)
expect
(
error
.
name
[
0
].
message
).
to
.
equal
(
"Invalid username"
)
User
.
build
({
name
:
"no error"
}).
validate
().
success
(
function
(
errors
)
{
User
.
build
({
name
:
"no error"
}).
validate
().
success
(
function
(
errors
)
{
expect
(
errors
).
not
.
to
.
be
.
defined
expect
(
errors
).
not
.
to
.
be
.
defined
done
()
done
()
...
@@ -578,7 +578,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -578,7 +578,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
})
})
})
})
})
})
it
(
'skips other validations if allowNull is true and the value is null'
,
function
(
done
)
{
it
(
'skips other validations if allowNull is true and the value is null'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
+
config
.
rand
(),
{
var
User
=
this
.
sequelize
.
define
(
'User'
+
config
.
rand
(),
{
age
:
{
age
:
{
...
@@ -755,7 +755,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -755,7 +755,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
}
}
}
}
})
})
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
sync
({
force
:
true
}).
success
(
function
()
{
User
.
create
({
name
:
"RedCat"
}).
success
(
function
(
user
){
User
.
create
({
name
:
"RedCat"
}).
success
(
function
(
user
){
expect
(
user
.
getDataValue
(
'name'
)).
to
.
equal
(
'RedCat'
)
expect
(
user
.
getDataValue
(
'name'
)).
to
.
equal
(
'RedCat'
)
...
@@ -770,7 +770,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -770,7 +770,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
})
})
})
})
})
})
it
(
"allows setting an immutable field if the record is unsaved"
,
function
(
done
)
{
it
(
"allows setting an immutable field if the record is unsaved"
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
name
:
{
name
:
{
...
@@ -780,10 +780,10 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -780,10 +780,10 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
}
}
}
}
})
})
var
user
=
User
.
build
({
name
:
"RedCat"
})
var
user
=
User
.
build
({
name
:
"RedCat"
})
expect
(
user
.
getDataValue
(
'name'
)).
to
.
equal
(
'RedCat'
)
expect
(
user
.
getDataValue
(
'name'
)).
to
.
equal
(
'RedCat'
)
user
.
setDataValue
(
'name'
,
'YellowCat'
)
user
.
setDataValue
(
'name'
,
'YellowCat'
)
user
.
validate
().
success
(
function
(
errors
)
{
user
.
validate
().
success
(
function
(
errors
)
{
expect
(
errors
).
not
.
to
.
be
.
ok
expect
(
errors
).
not
.
to
.
be
.
ok
...
@@ -844,7 +844,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
...
@@ -844,7 +844,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
type
:
Sequelize
.
VIRTUAL
,
type
:
Sequelize
.
VIRTUAL
,
set
:
function
(
val
)
{
set
:
function
(
val
)
{
this
.
setDataValue
(
'password'
,
val
);
this
.
setDataValue
(
'password'
,
val
);
this
.
setDataValue
(
'password_hash'
,
this
.
salt
+
val
);
this
.
setDataValue
(
'password_hash'
,
this
.
salt
+
val
);
},
},
validate
:
{
validate
:
{
isLongEnough
:
function
(
val
)
{
isLongEnough
:
function
(
val
)
{
...
...
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