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 1b49858a
authored
Jun 14, 2016
by
Sushant
Committed by
Jan Aagaard Meier
Jun 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(test) Model.count should not return NaN (#6101)
1 parent
f232209b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
2 deletions
test/integration/model/count.test.js
test/integration/model/count.test.js
View file @
1b49858
...
...
@@ -10,7 +10,8 @@ var chai = require('chai')
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
beforeEach
(
function
()
{
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
DataTypes
.
STRING
username
:
DataTypes
.
STRING
,
age
:
DataTypes
.
INTEGER
});
this
.
Project
=
this
.
sequelize
.
define
(
'Project'
,
{
name
:
DataTypes
.
STRING
...
...
@@ -65,12 +66,46 @@ describe(Support.getTestDialectTeaser('Model'), function() {
)
.
then
((
users
)
=>
{
expect
(
users
.
length
).
to
.
be
.
eql
(
2
);
// have attributes
expect
(
users
[
0
].
createdAt
).
to
.
exist
;
expect
(
users
[
1
].
createdAt
).
to
.
exist
;
});
});
it
(
'should not return NaN'
,
function
()
{
return
this
.
sequelize
.
sync
({
force
:
true
})
.
then
(()
=>
this
.
User
.
bulkCreate
([
{
username
:
'valak'
,
age
:
10
},
{
username
:
'conjuring'
,
age
:
20
},
{
username
:
'scary'
,
age
:
10
}
])
)
.
then
(()
=>
this
.
User
.
count
({
where
:
{
age
:
10
},
group
:
[
'age'
],
order
:
'age'
})
)
.
then
((
result
)
=>
{
expect
(
parseInt
(
result
[
0
].
count
)).
to
.
be
.
eql
(
2
);
return
this
.
User
.
count
({
where
:
{
username
:
'fire'
}
});
})
.
then
((
count
)
=>
{
expect
(
count
).
to
.
be
.
eql
(
0
);
return
this
.
User
.
count
({
where
:
{
username
:
'fire'
},
group
:
'age'
});
})
.
then
((
count
)
=>
{
expect
(
count
).
to
.
be
.
eql
([]);
});
});
});
});
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