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 6f4cdcfa
authored
Mar 02, 2016
by
Sushant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(tests) #4091, queries returns to 1=1 when non POJO used
1 parent
ef7793b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
test/unit/model/destroy.test.js
test/unit/model/update.test.js
test/unit/model/destroy.test.js
0 → 100644
View file @
6f4cdcf
'use strict'
;
/* jshint -W030 */
var
chai
=
require
(
'chai'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../support'
)
,
current
=
Support
.
sequelize
,
sinon
=
require
(
'sinon'
)
,
Promise
=
current
.
Promise
,
DataTypes
=
require
(
'../../../lib/data-types'
)
,
_
=
require
(
'lodash'
);
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
'method destroy'
,
function
()
{
var
User
=
current
.
define
(
'User'
,
{
name
:
DataTypes
.
STRING
,
secretValue
:
DataTypes
.
INTEGER
});
before
(
function
()
{
this
.
stubUpdate
=
sinon
.
stub
(
current
.
getQueryInterface
(),
'bulkDelete'
,
function
()
{
return
Promise
.
resolve
([]);
});
});
beforeEach
(
function
()
{
this
.
options
=
{
where
:
{
secretValue
:
'1'
}}
this
.
cloneOptions
=
_
.
clone
(
this
.
options
);
this
.
stubUpdate
.
reset
();
});
afterEach
(
function
()
{
delete
this
.
options
;
delete
this
.
cloneOptions
;
});
after
(
function
()
{
this
.
stubUpdate
.
restore
();
});
it
(
'properly clones options'
,
function
()
{
var
self
=
this
;
return
User
.
destroy
(
self
.
options
).
bind
(
this
).
then
(
function
(
e
)
{
expect
(
self
.
options
).
to
.
be
.
deep
.
eql
(
self
.
cloneOptions
);
});
});
it
(
'can detect complexe objects'
,
function
()
{
var
self
=
this
;
var
where
=
function
()
{
this
.
secretValue
=
'1'
;
}
return
expect
(
User
.
destroy
({
where
:
new
where
})).
to
.
eventually
.
be
.
rejectedWith
(
Error
);
});
});
});
test/unit/model/update.test.js
View file @
6f4cdcf
...
@@ -55,5 +55,10 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -55,5 +55,10 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
});
});
it
(
'can detect complexe objects'
,
function
()
{
var
self
=
this
;
var
where
=
function
()
{
this
.
secretValue
=
'1'
;
}
return
expect
(
User
.
update
(
self
.
updates
,
{
where
:
new
where
})).
to
.
eventually
.
be
.
rejectedWith
(
Error
);
});
});
});
});
});
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