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 649e43cd
authored
Dec 30, 2015
by
Sushant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix(#1150) : Test to verify findAll/find properly clone options
1 parent
ddce5fb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
test/unit/model/findall.test.js
test/unit/model/findone.test.js
test/unit/model/findall.test.js
View file @
649e43c
...
@@ -6,7 +6,8 @@ var chai = require('chai')
...
@@ -6,7 +6,8 @@ var chai = require('chai')
,
Support
=
require
(
__dirname
+
'/../support'
)
,
Support
=
require
(
__dirname
+
'/../support'
)
,
current
=
Support
.
sequelize
,
current
=
Support
.
sequelize
,
sinon
=
require
(
'sinon'
)
,
sinon
=
require
(
'sinon'
)
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
);
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
)
,
_
=
require
(
'lodash'
);
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
'method findAll'
,
function
()
{
describe
(
'method findAll'
,
function
()
{
...
@@ -87,6 +88,20 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -87,6 +88,20 @@ describe(Support.getTestDialectTeaser('Model'), function() {
]);
]);
});
});
});
});
it
(
'properly clones options values'
,
function
()
{
var
options
=
{
attributes
:
{
exclude
:
[
'name'
],
include
:
[
'name'
]
}
};
var
optionsClones
=
_
.
clone
(
options
);
return
Model
.
findAll
(
options
).
bind
(
this
).
then
(
function
()
{
expect
(
options
).
to
.
deep
.
equal
(
optionsClones
);
});
});
});
});
});
});
});
});
test/unit/model/findone.test.js
View file @
649e43c
...
@@ -7,7 +7,8 @@ var chai = require('chai')
...
@@ -7,7 +7,8 @@ var chai = require('chai')
,
current
=
Support
.
sequelize
,
current
=
Support
.
sequelize
,
sinon
=
require
(
'sinon'
)
,
sinon
=
require
(
'sinon'
)
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
)
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
)
,
Promise
=
require
(
'bluebird'
);
,
Promise
=
require
(
'bluebird'
)
,
_
=
require
(
'lodash'
);
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
'method findOne'
,
function
()
{
describe
(
'method findOne'
,
function
()
{
...
@@ -67,5 +68,16 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -67,5 +68,16 @@ describe(Support.getTestDialectTeaser('Model'), function() {
expect
(
this
.
stub
.
getCall
(
0
).
args
[
0
]).
to
.
be
.
an
(
'object'
).
to
.
have
.
property
(
'limit'
);
expect
(
this
.
stub
.
getCall
(
0
).
args
[
0
]).
to
.
be
.
an
(
'object'
).
to
.
have
.
property
(
'limit'
);
});
});
});
});
it
(
'properly clones options values'
,
function
()
{
var
options
=
{
where
:
{
id
:
{
$gt
:
42
}}}
,
optionsClones
=
_
.
clone
(
options
)
,
Model
=
current
.
define
(
'model'
);
return
Model
.
findOne
(
options
).
bind
(
this
).
then
(
function
()
{
expect
(
options
).
to
.
deep
.
equal
(
optionsClones
);
});
});
});
});
});
});
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