Skip to content

Commit

Permalink
Merge tag 'v16.0.1' into sc
Browse files Browse the repository at this point in the history
* emit aggregate room beacon liveness ([\matrix-org#2241](matrix-org#2241)).
* Live location sharing - create m.beacon_info events ([\matrix-org#2238](matrix-org#2238)).
* Beacon event types from MSC3489 ([\matrix-org#2230](matrix-org#2230)).
* Fix incorrect usage of unstable variant of `is_falling_back` ([\matrix-org#2227](matrix-org#2227)).
  • Loading branch information
su-ex committed Apr 1, 2022
2 parents 8daa03b + 0ad83c4 commit 9faf862
Show file tree
Hide file tree
Showing 53 changed files with 1,789 additions and 298 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Changes in [16.0.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v16.0.1) (2022-03-28)
==================================================================================================

## ✨ Features
* emit aggregate room beacon liveness ([\#2241](https://github.com/matrix-org/matrix-js-sdk/pull/2241)).
* Live location sharing - create m.beacon_info events ([\#2238](https://github.com/matrix-org/matrix-js-sdk/pull/2238)).
* Beacon event types from MSC3489 ([\#2230](https://github.com/matrix-org/matrix-js-sdk/pull/2230)).

## 🐛 Bug Fixes
* Fix incorrect usage of unstable variant of `is_falling_back` ([\#2227](https://github.com/matrix-org/matrix-js-sdk/pull/2227)).

Changes in [16.0.1-rc.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v16.0.1-rc.1) (2022-03-22)
============================================================================================================

Changes in [16.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v16.0.0) (2022-03-15)
==================================================================================================

Expand Down
54 changes: 42 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,48 @@ checks, so please check back after a few minutes.

Tests
-----
If your PR is a feature (ie. if it's being labelled with the 'T-Enhancement'
label) then we require that the PR also includes tests. These need to test that
your feature works as expected and ideally test edge cases too. For the js-sdk
itself, your tests should generally be unit tests. matrix-react-sdk also uses
these guidelines, so for that your tests can be unit tests using
react-test-utils, snapshot tests or screenshot tests.

We don't require tests for bug fixes (T-Defect) but strongly encourage regression
tests for the bug itself wherever possible.

In the future we may formalise this more with a minimum test coverage
percentage for the diff.
Your PR should include tests.

For new user facing features in `matrix-react-sdk` or `element-web`, you
must include:

1. Comprehensive unit tests written in Jest. These are located in `/test`.
2. "happy path" end-to-end tests.
These are located in `/test/end-to-end-tests` in `matrix-react-sdk`, and
are run using `element-web`. Ideally, you would also include tests for edge
and error cases.

Unit tests are expected even when the feature is in labs. It's good practice
to write tests alongside the code as it ensures the code is testable from
the start, and gives you a fast feedback loop while you're developing the
functionality. End-to-end tests should be added prior to the feature
leaving labs, but don't have to be present from the start (although it might
be beneficial to have some running early, so you can test things faster).

For bugs in those repos, your change must include at least one unit test or
end-to-end test; which is best depends on what sort of test most concisely
exercises the area.

Changes to `matrix-js-sdk` must be accompanied by unit tests written in Jest.
These are located in `/spec/`.

When writing unit tests, please aim for a high level of test coverage
for new code - 80% or greater. If you cannot achieve that, please document
why it's not possible in your PR.

Tests validate that your change works as intended and also document
concisely what is being changed. Ideally, your new tests fail
prior to your change, and succeed once it has been applied. You may
find this simpler to achieve if you write the tests first.

If you're spiking some code that's experimental and not being used to support
production features, exceptions can be made to requirements for tests.
Note that tests will still be required in order to ship the feature, and it's
strongly encouraged to think about tests early in the process, as adding
tests later will become progressively more difficult.

If you're not sure how to approach writing tests for your change, ask for help
in [#element-dev](https://matrix.to/#/#element-dev:matrix.org).

Code style
----------
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-js-sdk",
"version": "16.0.0",
"version": "16.0.1",
"description": "Matrix Client-Server SDK for Javascript",
"scripts": {
"prepublishOnly": "yarn build",
Expand Down
4 changes: 2 additions & 2 deletions spec/TestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import MockHttpBackend from 'matrix-mock-request';
import { LocalStorageCryptoStore } from '../src/crypto/store/localStorage-crypto-store';
import { logger } from '../src/logger';
import { WebStorageSessionStore } from "../src/store/session/webstorage";
import { syncPromise } from "./test-utils";
import { syncPromise } from "./test-utils/test-utils";
import { createClient } from "../src/matrix";
import { MockStorageApi } from "./MockStorageApi";

Expand Down Expand Up @@ -86,7 +86,7 @@ TestClient.prototype.toString = function() {
*/
TestClient.prototype.start = function() {
logger.log(this + ': starting');
this.httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
this.httpBackend.when("GET", "/versions").respond(200, {});
this.httpBackend.when("GET", "/pushrules").respond(200, {});
this.httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });
this.expectDeviceKeyUpload();
Expand Down
4 changes: 2 additions & 2 deletions spec/browserify/sync-browserify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
// load XmlHttpRequest mock
import "./setupTests";
import "../../dist/browser-matrix"; // uses browser-matrix instead of the src
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

const USER_ID = "@user:test.server";
Expand All @@ -35,7 +35,7 @@ describe("Browserify Test", function() {
client = testClient.client;
httpBackend = testClient.httpBackend;

httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });

Expand Down
2 changes: 1 addition & 1 deletion spec/integ/devicelist-integ-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
*/

import { TestClient } from '../TestClient';
import * as testUtils from '../test-utils';
import * as testUtils from '../test-utils/test-utils';
import { logger } from '../../src/logger';

const ROOM_ID = "!room:id";
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-crypto.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.
import '../olm-loader';

import { logger } from '../../src/logger';
import * as testUtils from "../test-utils";
import * as testUtils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";
import { CRYPTO_ENABLED } from "../../src/client";

Expand Down Expand Up @@ -722,7 +722,7 @@ describe("MatrixClient crypto", function() {
return Promise.resolve()
.then(() => {
logger.log(aliTestClient + ': starting');
httpBackend.when("GET", "/capabilities").respond(200, {});
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });
aliTestClient.expectDeviceKeyUpload();
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-event-emitter.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

describe("MatrixClient events", function() {
Expand All @@ -11,9 +11,9 @@ describe("MatrixClient events", function() {
const testClient = new TestClient(selfUserId, "DEVICE", selfAccessToken);
client = testClient.client;
httpBackend = testClient.httpBackend;
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "a filter id" });
httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
});

afterEach(function() {
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-event-timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { EventTimeline } from "../../src/matrix";
import { logger } from "../../src/logger";
import { TestClient } from "../TestClient";
Expand Down Expand Up @@ -71,7 +71,7 @@ const EVENTS = [

// start the client, and wait for it to initialise
function startClient(httpBackend, client) {
httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });
httpBackend.when("GET", "/sync").respond(200, INITIAL_SYNC_DATA);
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-methods.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { CRYPTO_ENABLED } from "../../src/client";
import { MatrixEvent } from "../../src/models/event";
import { Filter, MemoryStore, Room } from "../../src/matrix";
Expand Down Expand Up @@ -587,7 +587,7 @@ const buildEventMessageInThread = () => new MatrixEvent({
"m.in_reply_to": {
"event_id": "$VLS2ojbPmxb6x8ECetn45hmND6cRDcjgv-j-to9m7Vo",
},
"rel_type": "io.element.thread",
"rel_type": "m.thread",
},
"sender_key": "i3N3CtG/CD2bGB8rA9fW6adLYSDvlUhf2iuU73L65Vg",
"session_id": "Ja11R/KG6ua0wdk8zAzognrxjio1Gm/RK2Gn6lFL804",
Expand Down
6 changes: 3 additions & 3 deletions spec/integ/matrix-client-opts.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HttpBackend from "matrix-mock-request";

import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { MatrixClient } from "../../src/matrix";
import { MatrixScheduler } from "../../src/scheduler";
import { MemoryStore } from "../../src/store/memory";
Expand Down Expand Up @@ -105,12 +105,12 @@ describe("MatrixClient opts", function() {
expectedEventTypes.indexOf(event.getType()), 1,
);
});
httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "foo" });
httpBackend.when("GET", "/sync").respond(200, syncData);
client.startClient();
await httpBackend.flush("/capabilities", 1);
await httpBackend.flush("/versions", 1);
await httpBackend.flush("/pushrules", 1);
await httpBackend.flush("/filter", 1);
await Promise.all([
Expand Down
7 changes: 4 additions & 3 deletions spec/integ/matrix-client-room-timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { EventStatus } from "../../src/models/event";
import { TestClient } from "../TestClient";

Expand Down Expand Up @@ -109,7 +109,7 @@ describe("MatrixClient room timelines", function() {
client = testClient.client;

setNextSyncData();
httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "fid" });
httpBackend.when("GET", "/sync").respond(200, SYNC_DATA);
Expand All @@ -118,7 +118,7 @@ describe("MatrixClient room timelines", function() {
});
client.startClient();

await httpBackend.flush("/capabilities");
await httpBackend.flush("/versions");
await httpBackend.flush("/pushrules");
await httpBackend.flush("/filter");
});
Expand Down Expand Up @@ -553,6 +553,7 @@ describe("MatrixClient room timelines", function() {
NEXT_SYNC_DATA.rooms.join[roomId].timeline.limited = true;

return Promise.all([
httpBackend.flush("/versions", 1),
httpBackend.flush("/sync", 1),
utils.syncPromise(client),
]).then(() => {
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-syncing.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MatrixEvent } from "../../src/models/event";
import { EventTimeline } from "../../src/models/event-timeline";
import * as utils from "../test-utils";
import * as utils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";

describe("MatrixClient syncing", function() {
Expand All @@ -19,7 +19,7 @@ describe("MatrixClient syncing", function() {
const testClient = new TestClient(selfUserId, "DEVICE", selfAccessToken);
httpBackend = testClient.httpBackend;
client = testClient.client;
httpBackend.when("GET", "/capabilities").respond(200, { capabilities: {} });
httpBackend.when("GET", "/versions").respond(200, {});
httpBackend.when("GET", "/pushrules").respond(200, {});
httpBackend.when("POST", "/filter").respond(200, { filter_id: "a filter id" });
});
Expand Down
8 changes: 7 additions & 1 deletion spec/integ/megolm-integ.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.

import anotherjson from "another-json";

import * as testUtils from "../test-utils";
import * as testUtils from "../test-utils/test-utils";
import { TestClient } from "../TestClient";
import { logger } from "../../src/logger";

Expand Down Expand Up @@ -618,6 +618,9 @@ describe("megolm", function() {
aliceTestClient.httpBackend.when(
'PUT', '/sendToDevice/org.matrix.room_key.withheld/',
).respond(200, {});
aliceTestClient.httpBackend.when(
'PUT', '/sendToDevice/m.room_key.withheld/',
).respond(200, {});

return Promise.all([
aliceTestClient.client.sendTextMessage(ROOM_ID, 'test'),
Expand Down Expand Up @@ -718,6 +721,9 @@ describe("megolm", function() {
aliceTestClient.httpBackend.when(
'PUT', '/sendToDevice/org.matrix.room_key.withheld/',
).respond(200, {});
aliceTestClient.httpBackend.when(
'PUT', '/sendToDevice/m.room_key.withheld/',
).respond(200, {});

return Promise.all([
aliceTestClient.client.sendTextMessage(ROOM_ID, 'test2'),
Expand Down
Loading

0 comments on commit 9faf862

Please sign in to comment.