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 cca388be
authored
Jul 17, 2016
by
Eric Koslow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add postgres failing test
New integration test for grouped limit with schemas.
1 parent
8a4f5280
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
test/integration/include/schema.test.js
test/integration/include/schema.test.js
View file @
cca388b
...
@@ -707,6 +707,54 @@ describe(Support.getTestDialectTeaser('Includes with schemas'), function() {
...
@@ -707,6 +707,54 @@ describe(Support.getTestDialectTeaser('Includes with schemas'), function() {
});
});
});
});
it
(
'should be possible to define a hasMany include with grouped limit'
,
function
()
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{},
{
schema
:
'account'
})
,
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
title
:
DataTypes
.
STRING
},
{
schema
:
'account'
});
User
.
Tasks
=
User
.
hasMany
(
Task
,
{
as
:
'tasks'
});
return
this
.
sequelize
.
sync
({
force
:
true
}).
then
(
function
()
{
return
Promise
.
join
(
User
.
create
({
tasks
:
[
{
title
:
'b'
},
{
title
:
'd'
},
{
title
:
'c'
},
{
title
:
'a'
}
]
},
{
include
:
[
User
.
Tasks
]
}),
User
.
create
({
tasks
:
[
{
title
:
'a'
},
{
title
:
'c'
},
{
title
:
'b'
}
]
},
{
include
:
[
User
.
Tasks
]
})
);
}).
then
(
function
(
users
)
{
return
User
.
findAll
({
include
:
[{
model
:
Task
,
limit
:
2
,
as
:
'tasks'
}],
order
:
[
[
'id'
,
'ASC'
]
]
}).
then
(
function
(
result
)
{
expect
(
result
[
0
].
tasks
.
length
).
to
.
equal
(
2
);
expect
(
result
[
0
].
tasks
[
0
].
title
).
to
.
equal
(
'b'
);
expect
(
result
[
0
].
tasks
[
1
].
title
).
to
.
equal
(
'd'
);
expect
(
result
[
1
].
tasks
.
length
).
to
.
equal
(
2
);
expect
(
result
[
1
].
tasks
[
0
].
title
).
to
.
equal
(
'a'
);
expect
(
result
[
1
].
tasks
[
1
].
title
).
to
.
equal
(
'c'
);
});
});
});
it
(
'should be possible to define a belongsTo include as required with child hasMany with limit and aliases'
,
function
()
{
it
(
'should be possible to define a belongsTo include as required with child hasMany with limit and aliases'
,
function
()
{
var
User
=
this
.
sequelize
.
define
(
'User'
,
{},
{
schema
:
'account'
})
var
User
=
this
.
sequelize
.
define
(
'User'
,
{},
{
schema
:
'account'
})
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{
,
Group
=
this
.
sequelize
.
define
(
'Group'
,
{
...
...
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