forked from matrix-org/matrix-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support m.asset in m.location event content ([\matrix-org#2109](matrix-org#2109)). * Send extensible events structure and support on-demand parsing ([\matrix-org#2091](matrix-org#2091)). * Support cancelling events whilst they are in status = ENCRYPTING ([\matrix-org#2095](matrix-org#2095)). * Fix http-api butchering idServer requests ([\matrix-org#2134](matrix-org#2134)). Fixes element-hq/element-web#20680. * Don't remove streams that still have tracks ([\matrix-org#2104](matrix-org#2104)).
- Loading branch information
Showing
26 changed files
with
1,841 additions
and
1,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { makeLocationContent } from "../../src/content-helpers"; | ||
import { | ||
ASSET_NODE_TYPE, | ||
ASSET_TYPE_SELF, | ||
LOCATION_EVENT_TYPE, | ||
TIMESTAMP_NODE_TYPE, | ||
} from "../../src/@types/location"; | ||
import { TEXT_NODE_TYPE } from "../../src/@types/extensible_events"; | ||
|
||
describe("Location", function() { | ||
it("should create a valid location with defaults", function() { | ||
const loc = makeLocationContent("txt", "geo:foo", 134235435); | ||
expect(loc.body).toEqual("txt"); | ||
expect(loc.msgtype).toEqual("m.location"); | ||
expect(loc.geo_uri).toEqual("geo:foo"); | ||
expect(LOCATION_EVENT_TYPE.findIn(loc)).toEqual({ | ||
uri: "geo:foo", | ||
description: undefined, | ||
}); | ||
expect(ASSET_NODE_TYPE.findIn(loc)).toEqual({ type: ASSET_TYPE_SELF }); | ||
expect(TEXT_NODE_TYPE.findIn(loc)).toEqual("txt"); | ||
expect(TIMESTAMP_NODE_TYPE.findIn(loc)).toEqual(134235435); | ||
}); | ||
|
||
it("should create a valid location with explicit properties", function() { | ||
const loc = makeLocationContent( | ||
"txxt", "geo:bar", 134235436, "desc", "m.something"); | ||
|
||
expect(loc.body).toEqual("txxt"); | ||
expect(loc.msgtype).toEqual("m.location"); | ||
expect(loc.geo_uri).toEqual("geo:bar"); | ||
expect(LOCATION_EVENT_TYPE.findIn(loc)).toEqual({ | ||
uri: "geo:bar", | ||
description: "desc", | ||
}); | ||
expect(ASSET_NODE_TYPE.findIn(loc)).toEqual({ type: "m.something" }); | ||
expect(TEXT_NODE_TYPE.findIn(loc)).toEqual("txxt"); | ||
expect(TIMESTAMP_NODE_TYPE.findIn(loc)).toEqual(134235436); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.