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 f977d945
authored
Feb 21, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] provide tests for empty 1:1 include cases
1 parent
79a93b9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
test/include.test.js
test/include.test.js
View file @
f977d94
...
@@ -22,6 +22,42 @@ var sortById = function(a, b) {
...
@@ -22,6 +22,42 @@ var sortById = function(a, b) {
describe
(
Support
.
getTestDialectTeaser
(
"Include"
),
function
()
{
describe
(
Support
.
getTestDialectTeaser
(
"Include"
),
function
()
{
describe
(
'find'
,
function
()
{
describe
(
'find'
,
function
()
{
it
(
'should support a empty belongsTo include'
,
function
(
done
)
{
var
Company
=
this
.
sequelize
.
define
(
'Company'
,
{})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{})
User
.
belongsTo
(
Company
,
{
as
:
'Employer'
})
this
.
sequelize
.
sync
({
force
:
true
}).
done
(
function
()
{
User
.
create
().
then
(
function
()
{
User
.
find
({
include
:
[{
model
:
Company
,
as
:
'Employer'
}]
}).
done
(
function
(
err
,
user
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
user
).
to
.
be
.
ok
done
()
})
},
done
)
})
})
it
(
'should support a empty hasOne include'
,
function
(
done
)
{
var
Company
=
this
.
sequelize
.
define
(
'Company'
,
{})
,
Person
=
this
.
sequelize
.
define
(
'Person'
,
{})
Company
.
hasOne
(
Person
,
{
as
:
'CEO'
})
this
.
sequelize
.
sync
({
force
:
true
}).
done
(
function
()
{
Company
.
create
().
then
(
function
()
{
Company
.
find
({
include
:
[{
model
:
Person
,
as
:
'CEO'
}]
}).
done
(
function
(
err
,
company
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
company
).
to
.
be
.
ok
done
()
})
},
done
)
})
})
it
(
'should support a simple nested belongsTo -> belongsTo include'
,
function
(
done
)
{
it
(
'should support a simple nested belongsTo -> belongsTo include'
,
function
(
done
)
{
var
Task
=
this
.
sequelize
.
define
(
'Task'
,
{})
var
Task
=
this
.
sequelize
.
define
(
'Task'
,
{})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{})
,
User
=
this
.
sequelize
.
define
(
'User'
,
{})
...
...
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