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 21074872
authored
Apr 22, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(promises): example of better(?) test
1 parent
c9368843
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
test/associations/has-many.test.js
test/associations/has-many.test.js
View file @
2107487
...
...
@@ -1331,28 +1331,24 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
Worker
.
hasMany
(
Task
,
{
through
:
WorkerTasks
})
Task
.
hasMany
(
Worker
,
{
through
:
WorkerTasks
})
this
.
sequelize
.
sync
().
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
Worker
.
create
({}).
done
(
function
(
err
,
worker
)
{
expect
(
err
).
not
.
to
.
be
.
ok
Task
.
bulkCreate
([{},
{}]).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
Task
.
findAll
().
done
(
function
(
err
,
tasks
)
{
expect
(
err
).
not
.
to
.
be
.
ok
worker
.
setTasks
(
tasks
).
done
(
function
()
{
worker
.
removeTask
(
tasks
[
0
]).
done
(
function
(
err
)
{
expect
(
err
).
not
.
to
.
be
.
ok
worker
.
getTasks
().
done
(
function
(
err
,
tasks
)
{
expect
(
tasks
.
length
).
to
.
equal
(
1
)
done
()
})
})
})
})
// Test setup
this
.
sequelize
.
sync
().
then
(
function
()
{
return
Sequelize
.
Promise
.
all
([
Worker
.
create
({}),
Task
.
bulkCreate
([{},
{}]).
then
(
function
()
{
return
Task
.
findAll
()
})
})
})
]);
}).
spread
(
function
(
worker
,
tasks
)
{
// Set all tasks, then remove one tasks, then return all tasks
return
worker
.
setTasks
(
tasks
).
then
(
function
()
{
return
worker
.
removeTask
(
tasks
[
0
]);
}).
then
(
function
()
{
return
worker
.
getTasks
();
});
}).
then
(
function
(
tasks
)
{
expect
(
tasks
.
length
).
to
.
equal
(
1
);
}).
then
(
done
.
bind
(
null
,
null
),
done
);
})
})
})
...
...
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