Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d73f510

Browse files
author
Kerry Archibald
committed
use unstable prefix for wk tile_Server
Signed-off-by: Kerry Archibald <[email protected]>
1 parent c35fc16 commit d73f510

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

src/utils/WellKnownUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { MatrixClientPeg } from '../MatrixClientPeg';
2222
const CALL_BEHAVIOUR_WK_KEY = "io.element.call_behaviour";
2323
const E2EE_WK_KEY = "io.element.e2ee";
2424
const E2EE_WK_KEY_DEPRECATED = "im.vector.riot.e2ee";
25-
const TILE_SERVER_WK_KEY = new UnstableValue(
25+
export const TILE_SERVER_WK_KEY = new UnstableValue(
2626
"m.tile_server", "org.matrix.msc3488.tile_server");
2727

2828
/* eslint-disable camelcase */

test/components/views/location/LocationViewDialog-test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ import { RoomMember } from 'matrix-js-sdk/src/matrix';
2020
import { LocationAssetType } from 'matrix-js-sdk/src/@types/location';
2121

2222
import LocationViewDialog from '../../../../src/components/views/location/LocationViewDialog';
23+
import { TILE_SERVER_WK_KEY } from '../../../../src/utils/WellKnownUtils';
2324
import { getMockClientWithEventEmitter, makeLocationEvent } from '../../../test-utils';
2425

2526
describe('<LocationViewDialog />', () => {
2627
const roomId = '!room:server';
2728
const userId = '@user:server';
2829
const mockClient = getMockClientWithEventEmitter({
2930
getClientWellKnown: jest.fn().mockReturnValue({
30-
"m.tile_server": { map_style_url: 'maps.com' },
31+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
3132
}),
3233
isGuest: jest.fn().mockReturnValue(false),
3334
});

test/components/views/location/Map-test.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { logger } from 'matrix-js-sdk/src/logger';
2424
import Map from '../../../../src/components/views/location/Map';
2525
import { findByTestId, getMockClientWithEventEmitter } from '../../../test-utils';
2626
import MatrixClientContext from '../../../../src/contexts/MatrixClientContext';
27+
import { TILE_SERVER_WK_KEY } from '../../../../src/utils/WellKnownUtils';
2728

2829
describe('<Map />', () => {
2930
const defaultProps = {
@@ -34,7 +35,7 @@ describe('<Map />', () => {
3435
};
3536
const matrixClient = getMockClientWithEventEmitter({
3637
getClientWellKnown: jest.fn().mockReturnValue({
37-
"m.tile_server": { map_style_url: 'maps.com' },
38+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
3839
}),
3940
});
4041
const getComponent = (props = {}) =>
@@ -46,7 +47,7 @@ describe('<Map />', () => {
4647
beforeEach(() => {
4748
jest.clearAllMocks();
4849
matrixClient.getClientWellKnown.mockReturnValue({
49-
"m.tile_server": { map_style_url: 'maps.com' },
50+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
5051
});
5152

5253
jest.spyOn(logger, 'error').mockRestore();
@@ -65,7 +66,7 @@ describe('<Map />', () => {
6566

6667
act(() => {
6768
matrixClient.emit(ClientEvent.ClientWellKnown, {
68-
"m.tile_server": { map_style_url: 'new.maps.com' },
69+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'new.maps.com' },
6970
});
7071
});
7172

@@ -77,7 +78,7 @@ describe('<Map />', () => {
7778

7879
act(() => {
7980
matrixClient.emit(ClientEvent.ClientWellKnown, {
80-
"m.tile_server": { map_style_url: undefined },
81+
[TILE_SERVER_WK_KEY.name]: { map_style_url: undefined },
8182
});
8283
});
8384

test/components/views/messages/MBeaconBody-test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { getMockClientWithEventEmitter, makeBeaconEvent, makeBeaconInfoEvent } f
2929
import { RoomPermalinkCreator } from '../../../../src/utils/permalinks/Permalinks';
3030
import { MediaEventHelper } from '../../../../src/utils/MediaEventHelper';
3131
import MatrixClientContext from '../../../../src/contexts/MatrixClientContext';
32+
import { TILE_SERVER_WK_KEY } from '../../../../src/utils/WellKnownUtils';
3233

3334
describe('<MBeaconBody />', () => {
3435
// 14.03.2022 16:15
@@ -43,7 +44,7 @@ describe('<MBeaconBody />', () => {
4344

4445
const mockClient = getMockClientWithEventEmitter({
4546
getClientWellKnown: jest.fn().mockReturnValue({
46-
"m.tile_server": { map_style_url: 'maps.com' },
47+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
4748
}),
4849
getUserId: jest.fn().mockReturnValue(aliceId),
4950
getRoom: jest.fn(),

test/components/views/messages/MLocationBody-test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalink
2828
import { MediaEventHelper } from "../../../../src/utils/MediaEventHelper";
2929
import Modal from '../../../../src/Modal';
3030
import SdkConfig from "../../../../src/SdkConfig";
31+
import { TILE_SERVER_WK_KEY } from '../../../../src/utils/WellKnownUtils';
3132
import { makeLocationEvent } from "../../../test-utils/location";
3233
import { getMockClientWithEventEmitter } from '../../../test-utils';
3334

@@ -37,7 +38,7 @@ describe("MLocationBody", () => {
3738
const userId = '@user:server';
3839
const mockClient = getMockClientWithEventEmitter({
3940
getClientWellKnown: jest.fn().mockReturnValue({
40-
"m.tile_server": { map_style_url: 'maps.com' },
41+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
4142
}),
4243
isGuest: jest.fn().mockReturnValue(false),
4344
});
@@ -78,7 +79,7 @@ describe("MLocationBody", () => {
7879
it('displays correct fallback content when map_style_url is misconfigured', () => {
7980
const mockMap = new maplibregl.Map();
8081
mockClient.getClientWellKnown.mockReturnValue({
81-
"m.tile_server": { map_style_url: 'bad-tile-server.com' },
82+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'bad-tile-server.com' },
8283
});
8384
const component = getComponent();
8485

@@ -93,7 +94,7 @@ describe("MLocationBody", () => {
9394
describe('without error', () => {
9495
beforeEach(() => {
9596
mockClient.getClientWellKnown.mockReturnValue({
96-
"m.tile_server": { map_style_url: 'maps.com' },
97+
[TILE_SERVER_WK_KEY.name]: { map_style_url: 'maps.com' },
9798
});
9899

99100
// MLocationBody uses random number for map id

0 commit comments

Comments
 (0)