Update dependency maplibre-gl to v2 (#9699)

* Update dependency maplibre-gl to v2

* update types and mocks for maplibre 2.0

* prettier + strict fix

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
renovate[bot] 2022-12-18 23:17:15 +00:00 committed by GitHub
parent 9584388171
commit af3715821b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 97 additions and 104 deletions

View file

@ -19,7 +19,7 @@ import React from "react";
import { mount } from "enzyme";
import { LocationAssetType } from "matrix-js-sdk/src/@types/location";
import { ClientEvent, RoomMember } from "matrix-js-sdk/src/matrix";
import maplibregl from "maplibre-gl";
import * as maplibregl from "maplibre-gl";
import { logger } from "matrix-js-sdk/src/logger";
import { act } from "react-dom/test-utils";
import { SyncState } from "matrix-js-sdk/src/sync";
@ -35,6 +35,7 @@ import { makeLocationEvent } from "../../../test-utils/location";
import { getMockClientWithEventEmitter } from "../../../test-utils";
describe("MLocationBody", () => {
const mapOptions = { container: {} as unknown as HTMLElement, style: "" };
describe("<MLocationBody>", () => {
const roomId = "!room:server";
const userId = "@user:server";
@ -60,7 +61,7 @@ describe("MLocationBody", () => {
wrappingComponentProps: { value: mockClient },
});
const getMapErrorComponent = () => {
const mockMap = new maplibregl.Map();
const mockMap = new maplibregl.Map(mapOptions);
mockClient.getClientWellKnown.mockReturnValue({
[TILE_SERVER_WK_KEY.name]: { map_style_url: "bad-tile-server.com" },
});
@ -73,10 +74,6 @@ describe("MLocationBody", () => {
return component;
};
beforeAll(() => {
maplibregl.AttributionControl = jest.fn();
});
beforeEach(() => {
jest.clearAllMocks();
});
@ -131,7 +128,7 @@ describe("MLocationBody", () => {
});
it("renders map correctly", () => {
const mockMap = new maplibregl.Map();
const mockMap = new maplibregl.Map(mapOptions);
const component = getComponent();
expect(component).toMatchSnapshot();
@ -154,7 +151,7 @@ describe("MLocationBody", () => {
});
it("renders marker correctly for a non-self share", () => {
const mockMap = new maplibregl.Map();
const mockMap = new maplibregl.Map(mapOptions);
const component = getComponent();
expect(component.find("SmartMarker").at(0).props()).toEqual(