switch from Q to Bluebird
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
find,
|
||||
map,
|
||||
} from 'lodash';
|
||||
import Q from 'q';
|
||||
import Bluebird from 'bluebird';
|
||||
|
||||
describe('DELETE /user', () => {
|
||||
let user;
|
||||
@@ -30,7 +30,7 @@ describe('DELETE /user', () => {
|
||||
|
||||
await user.del('/user');
|
||||
|
||||
await Q.all(map(ids, id => {
|
||||
await Bluebird.all(map(ids, id => {
|
||||
return expect(checkExistence('tasks', id)).to.eventually.eql(false);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -2,7 +2,9 @@ import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
import xml2js from 'xml2js';
|
||||
import Q from 'q';
|
||||
import Bluebird from 'bluebird';
|
||||
|
||||
let parseStringAsync = Bluebird.promisify(xml2js.parseString, {context: xml2js});
|
||||
|
||||
describe('GET /export/userdata.xml', () => {
|
||||
it('should return a valid XML file with user data', async () => {
|
||||
@@ -22,7 +24,7 @@ describe('GET /export/userdata.xml', () => {
|
||||
]);
|
||||
|
||||
let response = await user.get('/export/userdata.xml');
|
||||
let {user: res} = await Q.npost(xml2js, 'parseString', [response, {explicitArray: false}]);
|
||||
let {user: res} = await parseStringAsync(response, {explicitArray: false});
|
||||
|
||||
expect(res._id).to.equal(user._id);
|
||||
expect(res).to.contain.all.keys(['tasks', 'flags', 'tasksOrder', 'auth']);
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
each,
|
||||
map,
|
||||
} from 'lodash';
|
||||
import Q from 'q';
|
||||
import Bluebird from 'bluebird';
|
||||
|
||||
describe('DELETE /user', () => {
|
||||
let user;
|
||||
@@ -55,7 +55,7 @@ describe('DELETE /user', () => {
|
||||
password,
|
||||
});
|
||||
|
||||
await Q.all(map(ids, id => {
|
||||
await Bluebird.all(map(ids, id => {
|
||||
return expect(checkExistence('tasks', id)).to.eventually.eql(false);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -2,10 +2,25 @@
|
||||
import request from 'request';
|
||||
import nconf from 'nconf';
|
||||
import nodemailer from 'nodemailer';
|
||||
import Q from 'q';
|
||||
import Bluebird from 'bluebird';
|
||||
import requireAgain from 'require-again';
|
||||
import logger from '../../../../../website/src/libs/api-v3/logger';
|
||||
|
||||
function defer () {
|
||||
let resolve;
|
||||
let reject;
|
||||
let promise = new Bluebird(() => {
|
||||
resolve = arguments[0];
|
||||
reject = arguments[1];
|
||||
});
|
||||
|
||||
return {
|
||||
resolve,
|
||||
reject,
|
||||
promise,
|
||||
};
|
||||
}
|
||||
|
||||
function getUser () {
|
||||
return {
|
||||
_id: 'random _id',
|
||||
@@ -37,7 +52,7 @@ describe('emails', () => {
|
||||
|
||||
describe('sendEmail', () => {
|
||||
it('can send an email using the default transport', () => {
|
||||
let sendMailSpy = sandbox.stub().returns(Q.defer().promise);
|
||||
let sendMailSpy = sandbox.stub().returns(defer().promise);
|
||||
|
||||
sandbox.stub(nodemailer, 'createTransport').returns({
|
||||
sendMail: sendMailSpy,
|
||||
@@ -49,7 +64,7 @@ describe('emails', () => {
|
||||
});
|
||||
|
||||
it('logs errors', (done) => {
|
||||
let deferred = Q.defer();
|
||||
let deferred = defer();
|
||||
let sendMailSpy = sandbox.stub().returns(deferred.promise);
|
||||
|
||||
sandbox.stub(nodemailer, 'createTransport').returns({
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
attachTranslateFunction,
|
||||
} from '../../../../../website/src/middlewares/api-v3/language';
|
||||
import common from '../../../../../common';
|
||||
import Q from 'q';
|
||||
import Bluebird from 'bluebird';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
|
||||
const i18n = common.i18n;
|
||||
@@ -162,7 +162,7 @@ describe('language middleware', () => {
|
||||
return this;
|
||||
},
|
||||
exec () {
|
||||
return Q.resolve({
|
||||
return Bluebird.resolve({
|
||||
preferences: {
|
||||
language: 'it',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user