{
props.error
@@ -142,12 +164,7 @@ export function LocationBodyContent(props: ILocationBodyContentProps):
}
-
+ { markerContents }
{
);
});
});
+
+ describe("isSelfLocation", () => {
+ it("Returns true for a full m.asset event", () => {
+ const content = makeLocationContent("", "", 0);
+ expect(isSelfLocation(content)).toBe(true);
+ });
+
+ it("Returns true for a missing m.asset", () => {
+ const content = {
+ body: "",
+ msgtype: "m.location",
+ geo_uri: "",
+ [LOCATION_EVENT_TYPE.name]: { uri: "" },
+ [TEXT_NODE_TYPE.name]: "",
+ [TIMESTAMP_NODE_TYPE.name]: 0,
+ // Note: no m.asset!
+ };
+ expect(isSelfLocation(content as ILocationContent)).toBe(true);
+ });
+
+ it("Returns true for a missing m.asset type", () => {
+ const content = {
+ body: "",
+ msgtype: "m.location",
+ geo_uri: "",
+ [LOCATION_EVENT_TYPE.name]: { uri: "" },
+ [TEXT_NODE_TYPE.name]: "",
+ [TIMESTAMP_NODE_TYPE.name]: 0,
+ [ASSET_NODE_TYPE.name]: {
+ // Note: no type!
+ },
+ };
+ expect(isSelfLocation(content as ILocationContent)).toBe(true);
+ });
+
+ it("Returns false for an unknown asset type", () => {
+ const content = makeLocationContent("", "", 0, "", "org.example.unknown");
+ expect(isSelfLocation(content)).toBe(false);
+ });
+ });
});
function oldLocationEvent(geoUri: string): MatrixEvent {