mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Update the tests to match https://github.com/matrix-org/matrix-react-sdk/pull/2340
See the react-sdk PR for some context.
This commit is contained in:
parent
b5c27ca074
commit
6ca0b3ad03
@ -43,6 +43,17 @@ import {parseQs, parseQsFromFragment} from '../../src/vector/url_utils';
|
|||||||
const DEFAULT_HS_URL='http://my_server';
|
const DEFAULT_HS_URL='http://my_server';
|
||||||
const DEFAULT_IS_URL='http://my_is';
|
const DEFAULT_IS_URL='http://my_is';
|
||||||
|
|
||||||
|
expect.extend({
|
||||||
|
toStartWith(prefix) {
|
||||||
|
expect.assert(
|
||||||
|
this.actual.startsWith(prefix),
|
||||||
|
'expected %s to start with %s',
|
||||||
|
this.actual, prefix,
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
describe('loading:', function() {
|
describe('loading:', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
let httpBackend;
|
let httpBackend;
|
||||||
@ -437,10 +448,7 @@ describe('loading:', function() {
|
|||||||
}).done(done, done);
|
}).done(done, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the last known homeserver to register with', function(done) {
|
it('uses the default homeserver to register with', function(done) {
|
||||||
localStorage.setItem("mx_hs_url", "https://homeserver" );
|
|
||||||
localStorage.setItem("mx_is_url", "https://idserver" );
|
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
||||||
Promise.delay(1).then(() => {
|
Promise.delay(1).then(() => {
|
||||||
@ -449,7 +457,7 @@ describe('loading:', function() {
|
|||||||
assertAtLoadingSpinner(matrixChat);
|
assertAtLoadingSpinner(matrixChat);
|
||||||
|
|
||||||
httpBackend.when('POST', '/register').check(function(req) {
|
httpBackend.when('POST', '/register').check(function(req) {
|
||||||
expect(req.path).toMatch(new RegExp("^https://homeserver/"));
|
expect(req.path).toStartWith(DEFAULT_HS_URL);
|
||||||
expect(req.queryParams.kind).toEqual('guest');
|
expect(req.queryParams.kind).toEqual('guest');
|
||||||
}).respond(200, {
|
}).respond(200, {
|
||||||
user_id: "@guest:localhost",
|
user_id: "@guest:localhost",
|
||||||
@ -462,15 +470,15 @@ describe('loading:', function() {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
return expectAndAwaitSync();
|
return expectAndAwaitSync();
|
||||||
}).then((req) => {
|
}).then((req) => {
|
||||||
expect(req.path).toMatch(new RegExp("^https://homeserver/"));
|
expect(req.path).toStartWith(DEFAULT_HS_URL);
|
||||||
|
|
||||||
// once the sync completes, we should have a home page
|
// once the sync completes, we should have a home page
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
ReactTestUtils.findRenderedComponentWithType(
|
ReactTestUtils.findRenderedComponentWithType(
|
||||||
matrixChat, sdk.getComponent('structures.HomePage'));
|
matrixChat, sdk.getComponent('structures.HomePage'));
|
||||||
expect(windowLocation.hash).toEqual("#/home");
|
expect(windowLocation.hash).toEqual("#/home");
|
||||||
expect(MatrixClientPeg.get().baseUrl).toEqual("https://homeserver");
|
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL);
|
||||||
expect(MatrixClientPeg.get().idBaseUrl).toEqual("https://idserver");
|
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL);
|
||||||
}).done(done, done);
|
}).done(done, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user