replace q method calls with bluebird ones
``` find src test -name '*.js' | xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/' ```
This commit is contained in:
parent
b29b4a959b
commit
d5b550f89a
8 changed files with 35 additions and 35 deletions
|
@ -118,7 +118,7 @@ describe('joining a room', function () {
|
|||
// wait for the directory requests
|
||||
httpBackend.when('POST', '/publicRooms').respond(200, {chunk: []});
|
||||
httpBackend.when('GET', '/thirdparty/protocols').respond(200, {});
|
||||
return q.all([
|
||||
return Promise.all([
|
||||
httpBackend.flush('/thirdparty/protocols'),
|
||||
httpBackend.flush('/publicRooms'),
|
||||
]);
|
||||
|
@ -139,14 +139,14 @@ describe('joining a room', function () {
|
|||
httpBackend.when('GET', '/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync")
|
||||
.respond(401, {errcode: 'M_GUEST_ACCESS_FORBIDDEN'});
|
||||
|
||||
return q.all([
|
||||
return Promise.all([
|
||||
httpBackend.flush('/directory/room/'+encodeURIComponent(ROOM_ALIAS), 1, 200),
|
||||
httpBackend.flush('/rooms/'+encodeURIComponent(ROOM_ID)+"/initialSync", 1, 200),
|
||||
]);
|
||||
}).then(() => {
|
||||
httpBackend.verifyNoOutstandingExpectation();
|
||||
|
||||
return q.delay(1);
|
||||
return Promise.delay(1);
|
||||
}).then(() => {
|
||||
// we should now have a roomview, with a preview bar
|
||||
roomView = ReactTestUtils.findRenderedComponentWithType(
|
||||
|
@ -164,14 +164,14 @@ describe('joining a room', function () {
|
|||
.respond(200, {room_id: ROOM_ID});
|
||||
}).then(() => {
|
||||
// wait for the join request to be made
|
||||
return q.delay(1);
|
||||
return Promise.delay(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 q.delay(1);
|
||||
return Promise.delay(1);
|
||||
}).then(() => {
|
||||
// the roomview should now be loading
|
||||
expect(roomView.state.room).toBe(null);
|
||||
|
@ -186,7 +186,7 @@ describe('joining a room', function () {
|
|||
}).then(() => {
|
||||
httpBackend.verifyNoOutstandingExpectation();
|
||||
|
||||
return q.delay(1);
|
||||
return Promise.delay(1);
|
||||
}).then(() => {
|
||||
// We've joined, expect this to false
|
||||
expect(roomView.state.joining).toBe(false);
|
||||
|
|
|
@ -103,7 +103,7 @@ describe('loading:', function () {
|
|||
toString: function() { return this.search + this.hash; },
|
||||
};
|
||||
|
||||
let tokenLoginCompleteDefer = q.defer();
|
||||
let tokenLoginCompleteDefer = Promise.defer();
|
||||
tokenLoginCompletePromise = tokenLoginCompleteDefer.promise;
|
||||
|
||||
function onNewScreen(screen) {
|
||||
|
@ -171,7 +171,7 @@ describe('loading:', function () {
|
|||
it('gives a login panel by default', function (done) {
|
||||
loadApp();
|
||||
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
@ -183,7 +183,7 @@ describe('loading:', function () {
|
|||
return httpBackend.flush();
|
||||
}).then(() => {
|
||||
// Wait for another trip around the event loop for the UI to update
|
||||
return q.delay(10);
|
||||
return Promise.delay(10);
|
||||
}).then(() => {
|
||||
// we expect a single <Login> component following session load
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
|
@ -197,7 +197,7 @@ describe('loading:', function () {
|
|||
uriFragment: "#/room/!room:id",
|
||||
});
|
||||
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
@ -209,7 +209,7 @@ describe('loading:', function () {
|
|||
return httpBackend.flush();
|
||||
}).then(() => {
|
||||
// Wait for another trip around the event loop for the UI to update
|
||||
return q.delay(10);
|
||||
return Promise.delay(10);
|
||||
}).then(() => {
|
||||
return completeLogin(matrixChat);
|
||||
}).then(() => {
|
||||
|
@ -232,7 +232,7 @@ describe('loading:', function () {
|
|||
uriFragment: "#/login",
|
||||
});
|
||||
|
||||
return q.delay(100).then(() => {
|
||||
return Promise.delay(100).then(() => {
|
||||
// we expect a single <Login> component
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('structures.login.Login'));
|
||||
|
@ -339,7 +339,7 @@ describe('loading:', function () {
|
|||
},
|
||||
});
|
||||
|
||||
return q.delay(1).then(() => {
|
||||
return Promise.delay(1).then(() => {
|
||||
// we expect a loading spinner while we log into the RTS
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
||||
|
@ -366,7 +366,7 @@ describe('loading:', function () {
|
|||
});
|
||||
|
||||
// give the UI a chance to display
|
||||
return q.delay(50);
|
||||
return Promise.delay(50);
|
||||
});
|
||||
|
||||
it('shows a login view', function() {
|
||||
|
@ -403,7 +403,7 @@ describe('loading:', function () {
|
|||
it('shows a home page by default', function (done) {
|
||||
loadApp();
|
||||
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
@ -436,7 +436,7 @@ describe('loading:', function () {
|
|||
|
||||
loadApp();
|
||||
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
@ -471,7 +471,7 @@ describe('loading:', function () {
|
|||
loadApp({
|
||||
uriFragment: "#/room/!room:id"
|
||||
});
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// at this point, we're trying to do a guest registration;
|
||||
// we expect a spinner
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
@ -530,7 +530,7 @@ describe('loading:', function () {
|
|||
|
||||
dis.dispatch({ action: 'start_login' });
|
||||
|
||||
return q.delay(1);
|
||||
return Promise.delay(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -559,7 +559,7 @@ describe('loading:', function () {
|
|||
|
||||
ReactTestUtils.Simulate.click(returnToApp);
|
||||
|
||||
return q.delay(1).then(() => {
|
||||
return Promise.delay(1).then(() => {
|
||||
// we should be straight back into the home page
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
matrixChat, sdk.getComponent('structures.HomePage'));
|
||||
|
@ -574,7 +574,7 @@ describe('loading:', function () {
|
|||
queryString: "?loginToken=secretToken&homeserver=https%3A%2F%2Fhomeserver&identityServer=https%3A%2F%2Fidserver",
|
||||
});
|
||||
|
||||
q.delay(1).then(() => {
|
||||
Promise.delay(1).then(() => {
|
||||
// we expect a spinner while we're logging in
|
||||
assertAtLoadingSpinner(matrixChat);
|
||||
|
||||
|
@ -629,7 +629,7 @@ describe('loading:', function () {
|
|||
|
||||
return httpBackend.flush().then(() => {
|
||||
// Wait for another trip around the event loop for the UI to update
|
||||
return q.delay(1);
|
||||
return Promise.delay(1);
|
||||
}).then(() => {
|
||||
// we expect a spinner
|
||||
ReactTestUtils.findRenderedComponentWithType(
|
||||
|
@ -674,7 +674,7 @@ function awaitSyncingSpinner(matrixChat, retryLimit, retryCount) {
|
|||
}
|
||||
// loading can take quite a long time, because we delete the
|
||||
// indexedDB store.
|
||||
return q.delay(5).then(() => {
|
||||
return Promise.delay(5).then(() => {
|
||||
return awaitSyncingSpinner(matrixChat, retryLimit, retryCount + 1);
|
||||
});
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) {
|
|||
throw new Error("MatrixChat still not ready after " +
|
||||
retryCount + " tries");
|
||||
}
|
||||
return q.delay(0).then(() => {
|
||||
return Promise.delay(0).then(() => {
|
||||
return awaitRoomView(matrixChat, retryLimit, retryCount + 1);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue