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 e4bd7b5d
authored
Apr 18, 2015
by
Ruben Bridgewater
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove promise tests that use the event emitter
1 parent
32bb8f45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
122 deletions
test/integration/promise.test.js
test/integration/promise.test.js
View file @
e4bd7b5
...
...
@@ -10,7 +10,7 @@ var chai = require('chai')
chai
.
config
.
includeStack
=
true
;
describe
.
skip
(
Support
.
getTestDialectTeaser
(
'Promise'
),
function
()
{
describe
(
Support
.
getTestDialectTeaser
(
'Promise'
),
function
()
{
beforeEach
(
function
()
{
return
Support
.
prepareTransactionTest
(
this
.
sequelize
).
bind
(
this
).
then
(
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
;
...
...
@@ -397,22 +397,6 @@ describe.skip(Support.getTestDialectTeaser('Promise'), function() {
});
});
it
(
'should still work with .success() when emitting'
,
function
(
done
)
{
var
spy
=
sinon
.
spy
()
,
promise
=
new
SequelizePromise
(
function
(
resolve
,
reject
)
{
// no-op
});
promise
.
success
(
spy
);
promise
.
then
(
function
()
{
expect
(
spy
.
calledOnce
).
to
.
be
.
true
;
expect
(
spy
.
firstCall
.
args
).
to
.
deep
.
equal
([
'yay'
]);
done
();
});
promise
.
emit
(
'success'
,
'yay'
);
});
it
(
'should still work with .done() when rejecting'
,
function
(
done
)
{
var
spy
=
sinon
.
spy
()
,
promise
=
new
SequelizePromise
(
function
(
resolve
,
reject
)
{
...
...
@@ -440,110 +424,5 @@ describe.skip(Support.getTestDialectTeaser('Promise'), function() {
done
();
});
});
it
(
'should still work with .on(\'error\') when throwing'
,
function
(
done
)
{
var
spy
=
sinon
.
spy
()
,
promise
=
new
SequelizePromise
(
function
(
resolve
,
reject
)
{
throw
new
Error
(
'noway'
);
});
promise
.
on
(
'error'
,
spy
);
promise
.
catch
(
function
()
{
expect
(
spy
.
calledOnce
).
to
.
be
.
true
;
expect
(
spy
.
firstCall
.
args
[
0
]).
to
.
be
.
an
.
instanceof
(
Error
);
done
();
});
});
it
(
'should still work with .error() when emitting'
,
function
(
done
)
{
var
spy
=
sinon
.
spy
()
,
promise
=
new
SequelizePromise
(
function
(
resolve
,
reject
)
{
// no-op
});
promise
.
on
(
'error'
,
spy
);
promise
.
catch
(
function
()
{
expect
(
spy
.
calledOnce
).
to
.
be
.
true
;
expect
(
spy
.
firstCall
.
args
[
0
]).
to
.
be
.
an
.
instanceof
(
Error
);
done
();
});
promise
.
emit
(
'error'
,
new
Error
(
'noway'
));
});
it
(
'should still support sql events'
,
function
()
{
var
spy
=
sinon
.
spy
()
,
promise
=
new
SequelizePromise
(
function
(
resolve
,
reject
)
{
resolve
(
'yay'
);
});
promise
.
on
(
'sql'
,
spy
);
promise
.
emit
(
'sql'
,
'SQL STATEMENT 1'
);
promise
.
emit
(
'sql'
,
'SQL STATEMENT 2'
);
return
promise
.
then
(
function
()
{
expect
(
spy
.
calledTwice
).
to
.
be
.
true
;
});
});
describe
(
'proxy'
,
function
()
{
it
(
'should correctly work with success listeners'
,
function
(
done
)
{
var
emitter
=
new
SequelizePromise
(
function
()
{})
,
proxy
=
new
SequelizePromise
(
function
()
{})
,
success
=
sinon
.
spy
();
emitter
.
success
(
success
);
proxy
.
success
(
function
()
{
process
.
nextTick
(
function
()
{
expect
(
success
.
called
).
to
.
be
.
true
;
done
();
});
});
proxy
.
proxy
(
emitter
);
proxy
.
emit
(
'success'
);
});
it
(
'should correctly work with complete/done listeners'
,
function
(
done
)
{
var
promise
=
new
SequelizePromise
(
function
()
{})
,
proxy
=
new
SequelizePromise
(
function
()
{})
,
complete
=
sinon
.
spy
();
promise
.
complete
(
complete
);
proxy
.
complete
(
function
()
{
process
.
nextTick
(
function
()
{
expect
(
complete
.
called
).
to
.
be
.
true
;
done
();
});
});
proxy
.
proxy
(
promise
);
proxy
.
emit
(
'success'
);
});
});
describe
(
'when emitting an error event with an array of errors'
,
function
()
{
describe
(
'if an error handler is given'
,
function
()
{
it
(
'should return the whole array'
,
function
(
done
)
{
var
emitter
=
new
SequelizePromise
(
function
()
{});
var
errors
=
[
[
new
Error
(
'First error'
),
new
Error
(
'Second error'
)
],
[
new
Error
(
'Third error'
)
]
];
emitter
.
error
(
function
(
err
)
{
expect
(
err
).
to
.
equal
(
errors
);
done
();
});
emitter
.
emit
(
'error'
,
errors
);
});
});
});
});
});
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