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 28b4a016
authored
Feb 04, 2014
by
Dan Kohn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for validation with allowNull:true; closes #1276
1 parent
f61a3938
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
test/dao-factory/create.test.js
test/dao-factory/create.test.js
View file @
28b4a01
...
...
@@ -407,6 +407,31 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
it
(
"raises an error if saving an empty string into a column allowing null or URL"
,
function
(
done
)
{
var
StringIsNullOrUrl
=
this
.
sequelize
.
define
(
'StringIsNullOrUrl'
,
{
str
:
{
type
:
Sequelize
.
STRING
,
allowNull
:
true
,
validate
:
{
isUrl
:
true
}
}
})
this
.
sequelize
.
options
.
omitNull
=
false
StringIsNullOrUrl
.
sync
({
force
:
true
}).
success
(
function
()
{
StringIsNullOrUrl
.
create
({
str
:
null
}).
success
(
function
(
str1
)
{
expect
(
str1
.
str
).
to
.
be
.
null
StringIsNullOrUrl
.
create
({
str
:
'http://sequelizejs.org'
}).
success
(
function
(
str2
)
{
expect
(
str2
.
str
).
to
.
equal
(
'http://sequelizejs.org'
)
StringIsNullOrUrl
.
create
({
str
:
''
}).
error
(
function
(
err
)
{
expect
(
err
).
to
.
exist
expect
(
err
.
str
[
0
]).
to
.
match
(
/Invalid URL: str/
)
done
()
})
})
})
})
})
it
(
'raises an error if you mess up the datatype'
,
function
(
done
)
{
var
self
=
this
expect
(
function
()
{
...
...
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