Move from browser-request
to fetch
(#23427)
This commit is contained in:
parent
326a1a9056
commit
2ef6abbfb8
8 changed files with 169 additions and 148 deletions
|
@ -41,6 +41,7 @@ import { RoomView as RoomViewClass } from 'matrix-react-sdk/src/components/struc
|
|||
import LoginComponent from 'matrix-react-sdk/src/components/structures/auth/Login';
|
||||
import WelcomeComponent from "matrix-react-sdk/src/components/views/auth/Welcome";
|
||||
import EmbeddedPage from "matrix-react-sdk/src/components/structures/EmbeddedPage";
|
||||
import { AutoDiscovery } from 'matrix-js-sdk/src/matrix';
|
||||
|
||||
const DEFAULT_HS_URL='http://my_server';
|
||||
const DEFAULT_IS_URL='http://my_is';
|
||||
|
@ -60,7 +61,7 @@ describe('loading:', function() {
|
|||
|
||||
beforeEach(function() {
|
||||
httpBackend = new MockHttpBackend();
|
||||
jssdk.request(httpBackend.requestFn);
|
||||
window.fetch = httpBackend.fetchFn;
|
||||
parentDiv = document.createElement('div');
|
||||
|
||||
// uncomment this to actually add the div to the UI, to help with
|
||||
|
@ -73,21 +74,25 @@ describe('loading:', function() {
|
|||
|
||||
afterEach(async function() {
|
||||
console.log(`${Date.now()}: loading: afterEach`);
|
||||
if (parentDiv) {
|
||||
ReactDOM.unmountComponentAtNode(parentDiv);
|
||||
parentDiv.remove();
|
||||
parentDiv = null;
|
||||
try {
|
||||
if (matrixChat) {
|
||||
ReactDOM.unmountComponentAtNode(parentDiv);
|
||||
parentDiv.remove();
|
||||
parentDiv = null;
|
||||
}
|
||||
|
||||
// unmounting should have cleared the MatrixClientPeg
|
||||
expect(MatrixClientPeg.get()).toBe(null);
|
||||
|
||||
// clear the indexeddbs so we can start from a clean slate next time.
|
||||
await Promise.all([
|
||||
test_utils.deleteIndexedDB('matrix-js-sdk:crypto'),
|
||||
test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'),
|
||||
]);
|
||||
cleanLocalstorage();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
// unmounting should have cleared the MatrixClientPeg
|
||||
expect(MatrixClientPeg.get()).toBe(null);
|
||||
|
||||
// clear the indexeddbs so we can start from a clean slate next time.
|
||||
await Promise.all([
|
||||
test_utils.deleteIndexedDB('matrix-js-sdk:crypto'),
|
||||
test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'),
|
||||
]);
|
||||
cleanLocalstorage();
|
||||
console.log(`${Date.now()}: loading: afterEach complete`);
|
||||
});
|
||||
|
||||
|
@ -421,7 +426,6 @@ describe('loading:', function() {
|
|||
|
||||
describe('Guest auto-registration:', function() {
|
||||
it('shows a welcome page by default', function() {
|
||||
|
||||
loadApp();
|
||||
|
||||
return sleep(1).then(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue