@@ -17,21 +17,11 @@ limitations under the License.
1717import React from 'react' ;
1818import { mount } from "enzyme" ;
1919import { mocked } from 'jest-mock' ;
20- import { makeLocationContent } from "matrix-js-sdk/src/content-helpers" ;
21- import {
22- M_ASSET ,
23- LocationAssetType ,
24- ILocationContent ,
25- M_LOCATION ,
26- M_TIMESTAMP ,
27- } from "matrix-js-sdk/src/@types/location" ;
28- import { TEXT_NODE_TYPE } from "matrix-js-sdk/src/@types/extensible_events" ;
20+ import { LocationAssetType } from "matrix-js-sdk/src/@types/location" ;
2921import maplibregl from 'maplibre-gl' ;
3022import { logger } from 'matrix-js-sdk/src/logger' ;
3123
32- import MLocationBody , {
33- isSelfLocation ,
34- } from "../../../../src/components/views/messages/MLocationBody" ;
24+ import MLocationBody from "../../../../src/components/views/messages/MLocationBody" ;
3525import MatrixClientContext from "../../../../src/contexts/MatrixClientContext" ;
3626import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks" ;
3727import { MediaEventHelper } from "../../../../src/utils/MediaEventHelper" ;
@@ -44,51 +34,6 @@ jest.mock("../../../../src/utils/WellKnownUtils", () => ({
4434} ) ) ;
4535
4636describe ( "MLocationBody" , ( ) => {
47- describe ( "isSelfLocation" , ( ) => {
48- it ( "Returns true for a full m.asset event" , ( ) => {
49- const content = makeLocationContent ( "" , '0' ) ;
50- expect ( isSelfLocation ( content ) ) . toBe ( true ) ;
51- } ) ;
52-
53- it ( "Returns true for a missing m.asset" , ( ) => {
54- const content = {
55- body : "" ,
56- msgtype : "m.location" ,
57- geo_uri : "" ,
58- [ M_LOCATION . name ] : { uri : "" } ,
59- [ TEXT_NODE_TYPE . name ] : "" ,
60- [ M_TIMESTAMP . name ] : 0 ,
61- // Note: no m.asset!
62- } ;
63- expect ( isSelfLocation ( content as ILocationContent ) ) . toBe ( true ) ;
64- } ) ;
65-
66- it ( "Returns true for a missing m.asset type" , ( ) => {
67- const content = {
68- body : "" ,
69- msgtype : "m.location" ,
70- geo_uri : "" ,
71- [ M_LOCATION . name ] : { uri : "" } ,
72- [ TEXT_NODE_TYPE . name ] : "" ,
73- [ M_TIMESTAMP . name ] : 0 ,
74- [ M_ASSET . name ] : {
75- // Note: no type!
76- } ,
77- } ;
78- expect ( isSelfLocation ( content as ILocationContent ) ) . toBe ( true ) ;
79- } ) ;
80-
81- it ( "Returns false for an unknown asset type" , ( ) => {
82- const content = makeLocationContent (
83- undefined , /* text */
84- "geo:foo" ,
85- 0 ,
86- undefined , /* description */
87- "org.example.unknown" as unknown as LocationAssetType ) ;
88- expect ( isSelfLocation ( content ) ) . toBe ( false ) ;
89- } ) ;
90- } ) ;
91-
9237 describe ( '<MLocationBody>' , ( ) => {
9338 describe ( 'with error' , ( ) => {
9439 const mockClient = {
0 commit comments