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 e847cd97
authored
Sep 07, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unit test possible covering #2029
1 parent
6b7e3e0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
test/include/find.test.js
test/include/find.test.js
View file @
e847cd9
...
@@ -49,7 +49,39 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -49,7 +49,39 @@ describe(Support.getTestDialectTeaser("Include"), function () {
done
();
done
();
});
});
});
});
});
it
(
'should include a model with a where condition but no required'
,
function
()
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{},
{
paranoid
:
false
})
,
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
deletedAt
:
{
type
:
DataTypes
.
DATE
}
},
{
paranoid
:
false
});
User
.
hasMany
(
Task
,
{
foreignKey
:
'userId'
});
Task
.
belongsTo
(
User
,
{
foreignKey
:
'userId'
});
return
this
.
sequelize
.
sync
({
force
:
true
}).
then
(
function
()
{
return
User
.
create
();
}).
then
(
function
(
user
)
{
return
Task
.
bulkCreate
([
{
userId
:
user
.
get
(
'id'
),
deletedAt
:
new
Date
()},
{
userId
:
user
.
get
(
'id'
),
deletedAt
:
new
Date
()},
{
userId
:
user
.
get
(
'id'
),
deletedAt
:
new
Date
()}
]);
}).
then
(
function
()
{
return
User
.
find
({
include
:
[
{
model
:
Task
,
where
:
{
deletedAt
:
null
},
required
:
false
}
]
});
}).
then
(
function
(
user
)
{
expect
(
user
).
to
.
be
.
ok
;
expect
(
user
.
Tasks
.
length
).
to
.
equal
(
0
);
});
});
});
it
(
"should still pull the main record when an included model is not required and has where restrictions without matches"
,
function
()
{
it
(
"should still pull the main record when an included model is not required and has where restrictions without matches"
,
function
()
{
...
...
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