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 82b29168
authored
Jul 01, 2014
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a couple of timing issues in tests related to mariadb
1 parent
df279741
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
test/associations/has-many.test.js
test/associations/has-many.test.js
View file @
82b2916
...
...
@@ -353,8 +353,9 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
return
article
.
setLabels
([
label1
,
label2
]).
then
(
function
()
{
return
article
.
getLabels
().
then
(
function
(
labels
)
{
expect
(
labels
).
to
.
have
.
length
(
2
);
expect
(
labels
[
0
].
ArticleHasLabel
.
color
).
to
.
equal
(
"red"
);
expect
(
labels
[
1
].
ArticleHasLabel
.
color
).
to
.
equal
(
"green"
);
expect
(
_
.
find
(
labels
,
function
(
label
)
{
return
label
.
lid
===
label1
.
lid
;
}).
ArticleHasLabel
.
color
).
to
.
equal
(
"red"
);
expect
(
_
.
find
(
labels
,
function
(
label
)
{
return
label
.
lid
===
label2
.
lid
;
}).
ArticleHasLabel
.
color
).
to
.
equal
(
"green"
);
});
});
});
...
...
@@ -638,32 +639,34 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
return
this
.
User
.
create
({
username
:
'foo'
}).
bind
({}).
then
(
function
(
user
)
{
this
.
user
=
user
;
return
Promise
.
all
([
self
.
Task
.
create
({
title
:
'task1'
}),
self
.
Task
.
create
({
title
:
'task2'
})
]);
}).
spread
(
function
(
task1
,
task2
)
{
return
this
.
user
.
setTasks
([
task1
,
task2
]).
on
(
'sql'
,
spy
).
on
(
'sql'
,
_
.
after
(
2
,
function
(
sql
)
{
return
self
.
Task
.
create
({
title
:
'task1'
});
}).
then
(
function
(
task1
)
{
this
.
task1
=
task1
;
return
self
.
Task
.
create
({
title
:
'task2'
});
}).
then
(
function
(
task2
)
{
this
.
task2
=
task2
;
return
this
.
user
.
setTasks
([
this
.
task1
,
this
.
task2
]).
on
(
'sql'
,
spy
).
on
(
'sql'
,
_
.
after
(
2
,
function
(
sql
)
{
// We don't care about SELECT, only UPDATE
expect
(
sql
).
to
.
have
.
string
(
"UPDATE"
);
expect
(
sql
).
to
.
have
.
string
(
"IN (1,2)"
);
}));
}).
then
(
function
()
{
expect
(
spy
.
calledTwice
).
to
.
be
.
ok
;
// Once for SELECT, once for UPDATE
expect
(
spy
).
to
.
have
.
been
.
calledTwice
;
// Once for SELECT, once for UPDATE
});
});
it
(
'uses one UPDATE statement'
,
function
()
{
var
spy
=
sinon
.
spy
();
var
self
=
this
,
spy
=
sinon
.
spy
();
return
this
.
User
.
create
({
username
:
'foo'
}).
bind
(
this
).
then
(
function
(
user
)
{
this
.
user
=
user
;
return
Promise
.
all
([
this
.
Task
.
create
({
title
:
'task1'
}),
this
.
Task
.
create
({
title
:
'task2'
})
]
);
}).
spread
(
function
(
task1
,
task2
)
{
return
this
.
user
.
setTasks
([
task1
,
task2
]);
return
self
.
Task
.
create
({
title
:
'task1'
});
}).
then
(
function
(
task1
)
{
this
.
task1
=
task1
;
return
self
.
Task
.
create
({
title
:
'task2'
}
);
}).
then
(
function
(
task2
)
{
return
this
.
user
.
setTasks
([
t
his
.
t
ask1
,
task2
]);
}).
then
(
function
()
{
return
this
.
user
.
setTasks
(
null
).
on
(
'sql'
,
spy
).
on
(
'sql'
,
_
.
after
(
2
,
function
(
sql
)
{
// We don't care about SELECT, only UPDATE
...
...
@@ -671,7 +674,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect
(
sql
).
to
.
have
.
string
(
"IN (1,2)"
);
}));
}).
then
(
function
()
{
expect
(
spy
.
calledTwice
).
to
.
be
.
ok
;
// Once for SELECT, once for UPDATE
expect
(
spy
).
to
.
have
.
been
.
calledTwice
;
// Once for SELECT, once for UPDATE
});
});
});
// end optimization using bulk create, destroy and update
...
...
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