transform-async-to-promises: get rid of bluebird

This commit is contained in:
Michael Telatynski 2019-11-04 12:46:28 +00:00
parent eab6ffe7db
commit 10e1d9093e
10 changed files with 38 additions and 55 deletions

View file

@ -24,9 +24,6 @@ require('skin-sdk');
const jssdk = require('matrix-js-sdk');
const sdk = require('matrix-react-sdk');
const peg = require('matrix-react-sdk/lib/MatrixClientPeg');
const dis = require('matrix-react-sdk/lib/dispatcher');
const PageTypes = require('matrix-react-sdk/lib/PageTypes');
const MatrixChat = sdk.getComponent('structures.MatrixChat');
const RoomDirectory = sdk.getComponent('structures.RoomDirectory');
const RoomPreviewBar = sdk.getComponent('rooms.RoomPreviewBar');
@ -36,9 +33,9 @@ const React = require('react');
const ReactDOM = require('react-dom');
const ReactTestUtils = require('react-dom/test-utils');
const expect = require('expect');
import Promise from 'bluebird';
import {makeType} from "matrix-react-sdk/lib/utils/TypeUtils";
import {ValidatedServerConfig} from "matrix-react-sdk/lib/utils/AutoDiscoveryUtils";
import {sleep} from "../test-utils";
const test_utils = require('../test-utils');
const MockHttpBackend = require('matrix-mock-request');
@ -173,7 +170,7 @@ describe('joining a room', function() {
matrixChat, RoomView);
// the preview bar may take a tick to be displayed
return Promise.delay(1);
return sleep(1);
}).then(() => {
const previewBar = ReactTestUtils.findRenderedComponentWithType(
roomView, RoomPreviewBar);
@ -187,14 +184,14 @@ describe('joining a room', function() {
.respond(200, {room_id: ROOM_ID});
}).then(() => {
// wait for the join request to be made
return Promise.delay(1);
return sleep(1);
}).then(() => {
// and again, because the state update has to go to the store and
// then one dispatch within the store, then to the view
// XXX: This is *super flaky*: a better way would be to declare
// that we expect a certain state transition to happen, then wait
// for that transition to occur.
return Promise.delay(1);
return sleep(1);
}).then(() => {
// the roomview should now be loading
expect(roomView.state.room).toBe(null);
@ -209,7 +206,7 @@ describe('joining a room', function() {
}).then(() => {
httpBackend.verifyNoOutstandingExpectation();
return Promise.delay(1);
return sleep(1);
}).then(() => {
// NB. we don't expect the 'joining' flag to reset at any point:
// it will stay set and we observe whether we have Room object for