mirror of https://github.com/vector-im/riot-web
Add mock to /versions API endpoint (#21380)
parent
2d3757c37f
commit
f149f9a9ad
|
@ -77,7 +77,6 @@ describe('joining a room', function() {
|
||||||
const ROOM_ALIAS = '#alias:localhost';
|
const ROOM_ALIAS = '#alias:localhost';
|
||||||
const ROOM_ID = '!id:localhost';
|
const ROOM_ID = '!id:localhost';
|
||||||
|
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities : {} });
|
|
||||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||||
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
|
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,6 @@ describe('loading:', function() {
|
||||||
// returns a promise resolving to the received request
|
// returns a promise resolving to the received request
|
||||||
async function expectAndAwaitSync(opts?) {
|
async function expectAndAwaitSync(opts?) {
|
||||||
let syncRequest = null;
|
let syncRequest = null;
|
||||||
const isGuest = opts && opts.isGuest;
|
|
||||||
if (!isGuest) {
|
|
||||||
httpBackend.when('GET', '/_matrix/client/versions')
|
httpBackend.when('GET', '/_matrix/client/versions')
|
||||||
.respond(200, {
|
.respond(200, {
|
||||||
"versions": ["r0.3.0"],
|
"versions": ["r0.3.0"],
|
||||||
|
@ -177,6 +175,8 @@ describe('loading:', function() {
|
||||||
"m.lazy_load_members": true
|
"m.lazy_load_members": true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const isGuest = opts && opts.isGuest;
|
||||||
|
if (!isGuest) {
|
||||||
// the call to create the LL filter
|
// the call to create the LL filter
|
||||||
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'llfid' });
|
httpBackend.when('POST', '/filter').respond(200, { filter_id: 'llfid' });
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,6 @@ describe('loading:', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the last known room by default', function() {
|
it('shows the last known room by default', function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities: {} });
|
|
||||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
@ -333,7 +332,6 @@ describe('loading:', function() {
|
||||||
it('shows a home page by default if we have no joined rooms', function() {
|
it('shows a home page by default if we have no joined rooms', function() {
|
||||||
localStorage.removeItem("mx_last_room_id");
|
localStorage.removeItem("mx_last_room_id");
|
||||||
|
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities : {} });
|
|
||||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
@ -351,7 +349,6 @@ describe('loading:', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows a room view if we followed a room link', function() {
|
it('shows a room view if we followed a room link', function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities : {} });
|
|
||||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||||
|
|
||||||
loadApp({
|
loadApp({
|
||||||
|
@ -425,7 +422,6 @@ describe('loading:', function() {
|
||||||
|
|
||||||
describe('Guest auto-registration:', function() {
|
describe('Guest auto-registration:', function() {
|
||||||
it('shows a welcome page by default', function() {
|
it('shows a welcome page by default', function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities: {} });
|
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
||||||
|
@ -457,7 +453,6 @@ describe('loading:', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses the default homeserver to register with', function() {
|
it('uses the default homeserver to register with', function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities: {} });
|
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
||||||
|
@ -493,7 +488,6 @@ describe('loading:', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows a room view if we followed a room link', function() {
|
it('shows a room view if we followed a room link', function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities: {} });
|
|
||||||
|
|
||||||
loadApp({
|
loadApp({
|
||||||
uriFragment: "#/room/!room:id",
|
uriFragment: "#/room/!room:id",
|
||||||
|
@ -526,7 +520,6 @@ describe('loading:', function() {
|
||||||
|
|
||||||
describe('Login as user', function() {
|
describe('Login as user', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities: {} });
|
|
||||||
|
|
||||||
// first we have to load the homepage
|
// first we have to load the homepage
|
||||||
loadApp();
|
loadApp();
|
||||||
|
@ -674,7 +667,6 @@ describe('loading:', function() {
|
||||||
// Wait for another trip around the event loop for the UI to update
|
// Wait for another trip around the event loop for the UI to update
|
||||||
return sleep(1);
|
return sleep(1);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
httpBackend.when('GET', '/capabilities').respond(200, { capabilities : {} });
|
|
||||||
httpBackend.when('GET', '/pushrules').respond(200, {});
|
httpBackend.when('GET', '/pushrules').respond(200, {});
|
||||||
return expectAndAwaitSync().catch((e) => {
|
return expectAndAwaitSync().catch((e) => {
|
||||||
throw new Error("Never got /sync after login: did the client start?");
|
throw new Error("Never got /sync after login: did the client start?");
|
||||||
|
|
Loading…
Reference in New Issue