2020-08-11 20:28:51 +03:00
|
|
|
require('./utils');
|
2020-03-30 18:26:47 +03:00
|
|
|
const sinon = require('sinon');
|
|
|
|
const Promise = require('bluebird');
|
2020-08-11 20:28:51 +03:00
|
|
|
const {sequence} = require('../');
|
2020-03-30 18:26:47 +03:00
|
|
|
|
|
|
|
describe('Unit: lib/promise/sequence', function () {
|
|
|
|
afterEach(function () {
|
|
|
|
sinon.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('mixed tasks: promise and none promise', function () {
|
|
|
|
const tasks = [
|
|
|
|
function a() {
|
|
|
|
return Promise.resolve('hello');
|
|
|
|
},
|
|
|
|
function b() {
|
|
|
|
return 'from';
|
|
|
|
},
|
|
|
|
function c() {
|
|
|
|
return Promise.resolve('chio');
|
|
|
|
}
|
|
|
|
];
|
|
|
|
return sequence(tasks)
|
|
|
|
.then(function (result) {
|
|
|
|
result.should.eql(['hello','from', 'chio']);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|