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 aa41e8c8
authored
Sep 30, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved specs
1 parent
7ec28db2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
53 deletions
spec-jasmine/dao.spec.js
spec/dao.spec.js
spec-jasmine/dao.spec.js
View file @
aa41e8c
...
...
@@ -554,60 +554,7 @@ describe('DAO', function() {
})
})
describe
(
'toJSON'
,
function
()
{
it
(
'returns an object containing all values'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
Helpers
.
async
(
function
(
done
)
{
User
.
sync
({
force
:
true
}).
success
(
done
)
})
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
user
.
toJSON
()).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
done
()
})
})
it
(
'returns a response that can be stringified'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
Helpers
.
async
(
function
(
done
)
{
User
.
sync
({
force
:
true
}).
success
(
done
)
})
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
JSON
.
stringify
(
user
)).
toEqual
(
'{"username":"test.user","age":99,"isAdmin":true,"id":null}'
)
done
()
})
})
it
(
'returns a response that can be stringified and then parsed'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
Helpers
.
async
(
function
(
done
)
{
User
.
sync
({
force
:
true
}).
success
(
done
)
})
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
done
()
})
})
})
})
})
})
spec/dao.spec.js
View file @
aa41e8c
...
...
@@ -69,5 +69,35 @@ dialects.forEach(function(dialect) {
})
})
})
describe
(
'toJSON'
,
function
toJSON
()
{
before
(
function
(
done
)
{
this
.
User
=
this
.
sequelize
.
define
(
'UserWithUsernameAndAgeAndIsAdmin'
,
{
username
:
Helpers
.
Sequelize
.
STRING
,
age
:
Helpers
.
Sequelize
.
INTEGER
,
isAdmin
:
Helpers
.
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
true
})
this
.
User
.
sync
({
force
:
true
}).
success
(
done
)
})
it
(
'returns an object containing all values'
,
function
()
{
var
user
=
this
.
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
user
.
toJSON
()).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
})
it
(
'returns a response that can be stringified'
,
function
()
{
var
user
=
this
.
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
JSON
.
stringify
(
user
)).
toEqual
(
'{"username":"test.user","age":99,"isAdmin":true,"id":null}'
)
})
it
(
'returns a response that can be stringified and then parsed'
,
function
()
{
var
user
=
this
.
User
.
build
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
})
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
isAdmin
:
true
,
id
:
null
})
})
})
})
})
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