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 bed9f836
authored
Jan 02, 2014
by
Steffen Persch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: should include associations to findAndCountAll
1 parent
77021ead
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
test/include.test.js
test/include.test.js
View file @
bed9f83
...
@@ -966,5 +966,55 @@ describe(Support.getTestDialectTeaser("Include"), function () {
...
@@ -966,5 +966,55 @@ describe(Support.getTestDialectTeaser("Include"), function () {
})
})
})
})
})
})
xit
(
'should include associations to findAndCountAll'
,
function
(
done
)
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
Item
=
this
.
sequelize
.
define
(
'Item'
,
{
'test'
:
DataTypes
.
STRING
})
User
.
hasOne
(
Item
);
Item
.
belongsTo
(
User
);
this
.
sequelize
.
sync
().
done
(
function
()
{
async
.
auto
({
users
:
function
(
callback
)
{
User
.
bulkCreate
([{},
{},
{}]).
done
(
function
()
{
User
.
findAll
().
done
(
callback
)
})
},
items
:
function
(
callback
)
{
Item
.
bulkCreate
([
{
'test'
:
'abc'
},
{
'test'
:
'def'
},
{
'test'
:
'ghi'
}
]).
done
(
function
()
{
Item
.
findAll
().
done
(
callback
)
})
},
associate
:
[
'users'
,
'items'
,
function
(
callback
,
results
)
{
var
chainer
=
new
Sequelize
.
Utils
.
QueryChainer
()
var
users
=
results
.
users
var
items
=
results
.
items
chainer
.
add
(
users
[
0
].
setItem
(
items
[
0
]))
chainer
.
add
(
users
[
1
].
setItem
(
items
[
1
]))
chainer
.
add
(
users
[
2
].
setItem
(
items
[
2
]))
chainer
.
run
().
done
(
callback
)
}]
},
function
()
{
User
.
findAndCountAll
({
'where'
:
{
'item.test'
:
'def'
},
'include'
:
[
Item
]}).
done
(
function
(
err
,
result
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
result
.
count
).
to
.
eql
(
1
)
expect
(
result
.
rows
.
length
).
to
.
eql
(
1
)
expect
(
result
.
rows
[
0
].
item
.
test
).
to
.
eql
(
'def'
)
done
()
})
})
})
})
})
})
})
})
\ No newline at end of file
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