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 672116ff
authored
Jun 17, 2014
by
Chris Wilhelm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit tests added for .find() and .findAll(), with included relation using own wh…
…ere and require: false.
1 parent
34fddc2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
test/model/attributes.test.js
test/model/attributes.test.js
View file @
672116f
...
@@ -194,6 +194,24 @@ describe(Support.getTestDialectTeaser("Model"), function () {
...
@@ -194,6 +194,24 @@ describe(Support.getTestDialectTeaser("Model"), function () {
});
});
});
});
it
(
'should work with where on includes for find when require is set to false and included relation has no results'
,
function
()
{
var
self
=
this
;
return
this
.
User
.
create
({
name
:
'Barfoo'
}).
then
(
function
(
user
)
{
return
self
.
User
.
find
({
where
:
{
name
:
'Barfoo'
},
include
:
[
{
model
:
self
.
Task
,
where
:
{
title
:
'idontexist'
},
require
:
false
}
]
});
}).
then
(
function
(
user
)
{
expect
(
user
).
to
.
not
.
equal
(
null
);
expect
(
user
.
get
(
'tasks'
)).
to
.
deep
.
equal
([]);
});
});
it
(
'should work with where on includes for findAll'
,
function
()
{
it
(
'should work with where on includes for findAll'
,
function
()
{
var
self
=
this
;
var
self
=
this
;
...
@@ -224,6 +242,24 @@ describe(Support.getTestDialectTeaser("Model"), function () {
...
@@ -224,6 +242,24 @@ describe(Support.getTestDialectTeaser("Model"), function () {
});
});
});
});
it
(
'should work with where on includes for findAll when require is set to false and included relation has no results'
,
function
()
{
var
self
=
this
;
return
this
.
User
.
create
({
name
:
'Barfoo'
}).
then
(
function
(
user
)
{
return
self
.
User
.
findAll
({
where
:
{
name
:
'Barfoo'
},
include
:
[
{
model
:
self
.
Task
,
where
:
{
title
:
'idontexist'
},
require
:
false
}
]
});
}).
then
(
function
(
users
)
{
expect
(
users
.
length
).
to
.
equal
(
1
);
expect
(
users
[
0
].
get
(
'tasks'
)).
deep
.
equal
([]);
});
});
it
(
'should work with a simple where'
,
function
()
{
it
(
'should work with a simple where'
,
function
()
{
var
self
=
this
;
var
self
=
this
;
...
...
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