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 4628af0a
authored
Apr 12, 2012
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use utc times
1 parent
9ca2a051
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
9 deletions
spec-jasmine/dao.spec.js
spec-jasmine/dao.spec.js
View file @
4628af0
...
@@ -496,9 +496,23 @@ describe('DAO', function() {
...
@@ -496,9 +496,23 @@ describe('DAO', function() {
})
})
})
})
})
})
describe
(
'toJSON'
,
function
()
{
describe
(
'toJSON'
,
function
()
{
beforeEach
(
function
()
{
this
.
convertDateToUTC
=
function
(
date
)
{
return
new
Date
(
date
.
getUTCFullYear
(),
date
.
getUTCMonth
(),
date
.
getUTCDate
(),
date
.
getUTCHours
(),
date
.
getUTCMinutes
(),
date
.
getUTCSeconds
());
}
})
it
(
'returns an object containing all values'
,
function
()
{
it
(
'returns an object containing all values'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
},
{
timestamps
:
false
,
logging
:
false
})
...
@@ -508,13 +522,15 @@ describe('DAO', function() {
...
@@ -508,13 +522,15 @@ describe('DAO', function() {
})
})
Helpers
.
async
(
function
(
done
)
{
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
new
Date
(
1973
,
4
,
6
),
isAdmin
:
true
})
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
self
.
convertDateToUTC
(
new
Date
(
1973
,
4
,
6
)
),
isAdmin
:
true
})
expect
(
user
.
toJSON
()).
toEqual
({
username
:
'test.user'
,
age
:
99
,
dob
:
new
Date
(
1973
,
4
,
6
),
isAdmin
:
true
,
id
:
null
})
expect
(
user
.
toJSON
()).
toEqual
({
username
:
'test.user'
,
age
:
99
,
dob
:
self
.
convertDateToUTC
(
new
Date
(
1973
,
4
,
6
)
),
isAdmin
:
true
,
id
:
null
})
done
()
done
()
})
})
})
})
it
(
'returns a response that can be stringified'
,
function
()
{
it
(
'returns a response that can be stringified'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
},
{
timestamps
:
false
,
logging
:
false
})
...
@@ -524,13 +540,14 @@ describe('DAO', function() {
...
@@ -524,13 +540,14 @@ describe('DAO', function() {
})
})
Helpers
.
async
(
function
(
done
)
{
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
new
Date
(
1973
,
4
,
6
),
isAdmin
:
true
})
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
self
.
convertDateToUTC
(
new
Date
(
1973
,
4
,
6
)
),
isAdmin
:
true
})
expect
(
JSON
.
stringify
(
user
)).
toEqual
(
'{"username":"test.user","age":99,"dob":"1973-05-05T2
3
:00:00.000Z","isAdmin":true,"id":null}'
)
expect
(
JSON
.
stringify
(
user
)).
toEqual
(
'{"username":"test.user","age":99,"dob":"1973-05-05T2
2
:00:00.000Z","isAdmin":true,"id":null}'
)
done
()
done
()
})
})
})
})
it
(
'returns a response that can be stringified and then parsed'
,
function
()
{
it
(
'returns a response that can be stringified and then parsed'
,
function
()
{
var
self
=
this
var
User
=
sequelize
.
define
(
'User'
,
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
username
:
Sequelize
.
STRING
,
age
:
Sequelize
.
INTEGER
,
dob
:
Sequelize
.
DATE
,
isAdmin
:
Sequelize
.
BOOLEAN
},
{
timestamps
:
false
,
logging
:
false
})
},
{
timestamps
:
false
,
logging
:
false
})
...
@@ -540,8 +557,8 @@ describe('DAO', function() {
...
@@ -540,8 +557,8 @@ describe('DAO', function() {
})
})
Helpers
.
async
(
function
(
done
)
{
Helpers
.
async
(
function
(
done
)
{
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
new
Date
(
1973
,
4
,
6
),
isAdmin
:
true
})
var
user
=
User
.
build
({
username
:
'test.user'
,
age
:
99
,
dob
:
self
.
convertDateToUTC
(
new
Date
(
1973
,
4
,
6
)
),
isAdmin
:
true
})
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
dob
:
"1973-05-05T2
3
:00:00.000Z"
,
isAdmin
:
true
,
id
:
null
})
expect
(
JSON
.
parse
(
JSON
.
stringify
(
user
))).
toEqual
({
username
:
'test.user'
,
age
:
99
,
dob
:
"1973-05-05T2
2
:00:00.000Z"
,
isAdmin
:
true
,
id
:
null
})
done
()
done
()
})
})
})
})
...
...
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