transform-async-to-promises: get rid of bluebird
This commit is contained in:
@@ -25,7 +25,6 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactTestUtils from 'react-dom/test-utils';
|
||||
import expect from 'expect';
|
||||
import Promise from 'bluebird';
|
||||
import MatrixReactTestUtils from 'matrix-react-test-utils';
|
||||
|
||||
import jssdk from 'matrix-js-sdk';
|
||||
@@ -41,6 +40,7 @@ import MockHttpBackend from 'matrix-mock-request';
|
||||
import {parseQs, parseQsFromFragment} from '../../src/vector/url_utils';
|
||||
import {makeType} from "matrix-react-sdk/lib/utils/TypeUtils";
|
||||
import {ValidatedServerConfig} from "matrix-react-sdk/lib/utils/AutoDiscoveryUtils";
|
||||
import {sleep} from "../test-utils";
|
||||
|
||||
const DEFAULT_HS_URL='http://my_server';
|
||||
const DEFAULT_IS_URL='http://my_is';
|
||||
@@ -216,7 +216,7 @@ describe('loading:', function() {
|
||||
it('gives a welcome page by default', function(done) {
|
||||
loadApp();
|
||||
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
@@ -231,7 +231,7 @@ describe('loading:', function() {
|
||||
return awaitWelcomeComponent(matrixChat);
|
||||
}).then(() => {
|
||||
expect(windowLocation.hash).toEqual("#/welcome");
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
it('should follow the original link after successful login', function(done) {
|
||||
@@ -243,7 +243,7 @@ describe('loading:', function() {
|
||||
httpBackend.when("GET", "/versions").respond(200, {versions: ["r0.4.0"]});
|
||||
httpBackend.when("GET", "/api/v1").respond(200, {});
|
||||
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
@@ -255,7 +255,7 @@ describe('loading:', function() {
|
||||
return httpBackend.flush();
|
||||
}).then(() => {
|
||||
// Wait for another trip around the event loop for the UI to update
|
||||
return Promise.delay(10);
|
||||
return sleep(10);
|
||||
}).then(() => {
|
||||
return moveFromWelcomeToLogin(matrixChat);
|
||||
}).then(() => {
|
||||
@@ -272,7 +272,7 @@ describe('loading:', function() {
|
||||
expect(localStorage.getItem('mx_access_token')).toEqual('access_token');
|
||||
expect(localStorage.getItem('mx_hs_url')).toEqual(DEFAULT_HS_URL);
|
||||
expect(localStorage.getItem('mx_is_url')).toEqual(DEFAULT_IS_URL);
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
it('should not register as a guest when using a #/login link', function() {
|
||||
@@ -365,7 +365,7 @@ describe('loading:', function() {
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('structures.EmbeddedPage'));
|
||||
expect(windowLocation.hash).toEqual("#/home");
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
it('shows a room view if we followed a room link', function(done) {
|
||||
@@ -385,7 +385,7 @@ describe('loading:', function() {
|
||||
}).then(() => {
|
||||
httpBackend.verifyNoOutstandingExpectation();
|
||||
expect(windowLocation.hash).toEqual("#/room/!room:id");
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
describe('/#/login link:', function() {
|
||||
@@ -445,7 +445,7 @@ describe('loading:', function() {
|
||||
it('shows a welcome page by default', function(done) {
|
||||
loadApp();
|
||||
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
@@ -469,13 +469,13 @@ describe('loading:', function() {
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('auth.Welcome'));
|
||||
expect(windowLocation.hash).toEqual("#/welcome");
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
it('uses the default homeserver to register with', function(done) {
|
||||
loadApp();
|
||||
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
@@ -503,14 +503,14 @@ describe('loading:', function() {
|
||||
expect(windowLocation.hash).toEqual("#/welcome");
|
||||
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL);
|
||||
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL);
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
it('shows a room view if we followed a room link', function(done) {
|
||||
loadApp({
|
||||
uriFragment: "#/room/!room:id",
|
||||
});
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
@@ -533,7 +533,7 @@ describe('loading:', function() {
|
||||
}).then(() => {
|
||||
httpBackend.verifyNoOutstandingExpectation();
|
||||
expect(windowLocation.hash).toEqual("#/room/!room:id");
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
|
||||
describe('Login as user', function() {
|
||||
@@ -600,7 +600,7 @@ describe('loading:', function() {
|
||||
|
||||
ReactTestUtils.Simulate.click(returnToApp);
|
||||
|
||||
return Promise.delay(1).then(() => {
|
||||
return sleep(1).then(() => {
|
||||
// we should be straight back into the home page
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('structures.EmbeddedPage'));
|
||||
@@ -616,7 +616,7 @@ describe('loading:', function() {
|
||||
queryString: "?loginToken=secretToken&homeserver=https%3A%2F%2Fhomeserver&identityServer=https%3A%2F%2Fidserver",
|
||||
});
|
||||
|
||||
Promise.delay(1).then(() => {
|
||||
sleep(1).then(() => {
|
||||
// we expect a spinner while we're logging in
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
||||
@@ -645,7 +645,7 @@ describe('loading:', function() {
|
||||
expect(localStorage.getItem('mx_access_token')).toEqual('access_token');
|
||||
expect(localStorage.getItem('mx_hs_url')).toEqual('https://homeserver');
|
||||
expect(localStorage.getItem('mx_is_url')).toEqual('https://idserver');
|
||||
}).done(done, done);
|
||||
}).then(done, done);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -664,7 +664,7 @@ describe('loading:', function() {
|
||||
|
||||
// Give the component some time to finish processing the login flows before
|
||||
// continuing.
|
||||
await Promise.delay(100);
|
||||
await sleep(100);
|
||||
|
||||
httpBackend.when('POST', '/login').check(function(req) {
|
||||
expect(req.data.type).toEqual('m.login.password');
|
||||
@@ -680,7 +680,7 @@ describe('loading:', function() {
|
||||
|
||||
return httpBackend.flush().then(() => {
|
||||
// Wait for another trip around the event loop for the UI to update
|
||||
return Promise.delay(1);
|
||||
return sleep(1);
|
||||
}).then(() => {
|
||||
// we expect a spinner
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
@@ -738,7 +738,7 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) {
|
||||
throw new Error("MatrixChat still not ready after " +
|
||||
retryCount + " tries");
|
||||
}
|
||||
return Promise.delay(0).then(() => {
|
||||
return sleep(0).then(() => {
|
||||
return awaitRoomView(matrixChat, retryLimit, retryCount + 1);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user