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 39fa5979
authored
Jun 19, 2018
by
Mirko Jotic
Committed by
Jan Aagaard Meier
Jun 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(belongsToMany): add source and target to belongs-to-many.js AssociationError (#9562)
1 parent
7525ef06
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
lib/associations/belongs-to-many.js
test/unit/associations/belongs-to-many.test.js
lib/associations/belongs-to-many.js
View file @
39fa597
...
@@ -61,7 +61,7 @@ class BelongsToMany extends Association {
...
@@ -61,7 +61,7 @@ class BelongsToMany extends Association {
super
(
source
,
target
,
options
);
super
(
source
,
target
,
options
);
if
(
this
.
options
.
through
===
undefined
||
this
.
options
.
through
===
true
||
this
.
options
.
through
===
null
)
{
if
(
this
.
options
.
through
===
undefined
||
this
.
options
.
through
===
true
||
this
.
options
.
through
===
null
)
{
throw
new
AssociationError
(
'belongsToMany must be given a through option, either a string or a model'
);
throw
new
AssociationError
(
`
${
source
.
name
}
.belongsToMany(
${
target
.
name
}
) requires through option, pass either a string or a model`
);
}
}
if
(
!
this
.
options
.
through
.
model
)
{
if
(
!
this
.
options
.
through
.
model
)
{
...
...
test/unit/associations/belongs-to-many.test.js
View file @
39fa597
...
@@ -107,7 +107,7 @@ describe(Support.getTestDialectTeaser('belongsToMany'), () => {
...
@@ -107,7 +107,7 @@ describe(Support.getTestDialectTeaser('belongsToMany'), () => {
const
errorFunction2
=
User
.
belongsToMany
.
bind
(
User
,
Task
,
{
through
:
undefined
});
const
errorFunction2
=
User
.
belongsToMany
.
bind
(
User
,
Task
,
{
through
:
undefined
});
const
errorFunction3
=
User
.
belongsToMany
.
bind
(
User
,
Task
,
{
through
:
null
});
const
errorFunction3
=
User
.
belongsToMany
.
bind
(
User
,
Task
,
{
through
:
null
});
for
(
const
errorFunction
of
[
errorFunction1
,
errorFunction2
,
errorFunction3
])
{
for
(
const
errorFunction
of
[
errorFunction1
,
errorFunction2
,
errorFunction3
])
{
expect
(
errorFunction
).
to
.
throw
(
AssociationError
,
'belongsToMany must be given a through option, either a string or a model'
);
expect
(
errorFunction
).
to
.
throw
(
AssociationError
,
`
${
User
.
name
}
.belongsToMany(
${
Task
.
name
}
) requires through option, pass either a string or a model`
);
}
}
});
});
it
(
'throws an AssociationError for a self-association defined without an alias'
,
()
=>
{
it
(
'throws an AssociationError for a self-association defined without an alias'
,
()
=>
{
...
...
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