Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test typescriptification - last few unit test files #2675

Merged
merged 9 commits into from
Sep 16, 2022

Conversation

kerryarchibald
Copy link
Contributor

@kerryarchibald kerryarchibald commented Sep 16, 2022

#2353

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@kerryarchibald kerryarchibald added the T-Task Tasks for the team like planning label Sep 16, 2022
@kerryarchibald kerryarchibald requested a review from a team as a code owner September 16, 2022 11:14
Copy link
Contributor

@duxovni duxovni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from minor code style nitpicks

@@ -115,7 +133,7 @@ function makeRemoteEcho(event) {

async function distributeEvent(ownRequest, theirRequest, event) {
await ownRequest.channel.handleEvent(
makeRemoteEcho(event), ownRequest, true);
makeRemoteEcho(event), ownRequest, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
makeRemoteEcho(event), ownRequest, true);
makeRemoteEcho(event), ownRequest, true,
);

new InRoomChannel(alice, "!room", bob.getUserId()),
new Map([[MOCK_METHOD, MockVerifier]]), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!),
verificationMethods, alice);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verificationMethods, alice);
verificationMethods, alice,
);

const bobRequest = new VerificationRequest(
new InRoomChannel(bob, "!room"),
new Map([[MOCK_METHOD, MockVerifier]]), bob);
verificationMethods, bob);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verificationMethods, bob);
verificationMethods, bob,
);

new InRoomChannel(alice, "!room", bob.getUserId()),
new Map([["c", function() {}], ["a", function() {}]]), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!),
aliceVerificationMethods, alice);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aliceVerificationMethods, alice);
aliceVerificationMethods, alice,
);

const bobRequest = new VerificationRequest(
new InRoomChannel(bob, "!room"),
new Map([["c", function() {}], ["b", function() {}]]), bob);
bobVerificationMethods, bob);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bobVerificationMethods, bob);
bobVerificationMethods, bob,
);

Comment on lines 255 to 256
new ToDeviceChannel(bob1, bob1.getUserId()!, ["device1", "device2"],
ToDeviceChannel.makeTransactionId(), "device2"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new ToDeviceChannel(bob1, bob1.getUserId()!, ["device1", "device2"],
ToDeviceChannel.makeTransactionId(), "device2"),
new ToDeviceChannel(
bob1, bob1.getUserId()!, ["device1", "device2"],
ToDeviceChannel.makeTransactionId(), "device2",
),

ToDeviceChannel.makeTransactionId(), "device2"),
new Map([[MOCK_METHOD, MockVerifier]]), bob1);
verificationMethods, bob1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verificationMethods, bob1);
verificationMethods, bob1,
);

new ToDeviceChannel(bob2, bob2.getUserId(), ["device1"]),
new Map([[MOCK_METHOD, MockVerifier]]), bob2);
new ToDeviceChannel(bob2, bob2.getUserId()!, ["device1"]),
verificationMethods, bob2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verificationMethods, bob2);
verificationMethods, bob2,
);

@@ -253,11 +282,10 @@ describe("verification request unit tests", function() {
const alice = makeMockClient("@alice:matrix.tld", "device1");
const bob = makeMockClient("@bob:matrix.tld", "device1");
const aliceRequest = new VerificationRequest(
new InRoomChannel(alice, "!room", bob.getUserId()), new Map(), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice,
);

@@ -269,7 +297,7 @@ describe("verification request unit tests", function() {
const alice = makeMockClient("@alice:matrix.tld", "device1");
const bob = makeMockClient("@bob:matrix.tld", "device1");
const aliceRequest = new VerificationRequest(
new InRoomChannel(alice, "!room", bob.getUserId()), new Map(), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice);
new InRoomChannel(alice, "!room", bob.getUserId()!), new Map(), alice,
);

@kerryarchibald kerryarchibald enabled auto-merge (squash) September 16, 2022 15:53
@kerryarchibald kerryarchibald merged commit 9ff11d1 into develop Sep 16, 2022
@kerryarchibald kerryarchibald deleted the kerry/ts-test-16-9 branch September 16, 2022 16:00
SimonBrandner added a commit that referenced this pull request Sep 22, 2022
* Update sonarcloud.yml (#2671)

* Update sonarcloud.yml

* test typescriptification - spec/unit/crypto/verification (#2673)

* renamed:    spec/unit/crypto/verification/request.spec.js -> spec/unit/crypto/verification/request.spec.ts

* renamed:    spec/unit/crypto/verification/qr_code.spec.js -> spec/unit/crypto/verification/qr_code.spec.ts

* renamed:    spec/unit/crypto/verification/InRoomChannel.spec.js -> spec/unit/crypto/verification/InRoomChannel.spec.ts

* fix ts issues in InRoomChannel.spec

* renamed:    spec/unit/crypto/verification/util.js -> spec/unit/crypto/verification/util.ts

* fix ts issues in util.t

* fix strict errors in util.ts

* js lint

* test typescriptification - last few unit test files (#2675)

* renamed:    spec/unit/crypto/verification/sas.spec.js -> spec/unit/crypto/verification/sas.spec.ts

* ts issues in sas.spec

* renamed:    spec/unit/crypto/verification/secret_request.spec.js -> spec/unit/crypto/verification/secret_request.spec.ts

* ts issues in secret_request.spec

* renamed:    spec/unit/crypto/verification/verification_request.spec.js -> spec/unit/crypto/verification/verification_request.spec.ts

* ts fix verification_req.spec

* renamed:    spec/browserify/sync-browserify.spec.js -> spec/browserify/sync-browserify.spec.ts

* fix strict

* formatting

* Update babel monorepo to v7.19.1 (#2681)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update typescript-eslint monorepo to v5.38.0 (#2685)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Read receipts for threads (#2635)

* Update all (#2684)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update jest monorepo to v29.0.3 (#2682)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix backpagination at end logic being spec non-conforming (#2680)

* Support to remotely toggle push notifications (#2686)

* Add unstable device_id field for MSC3881 (#2688)

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Kerry <kerrya@element.io>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Germain <germains@element.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants