Skip to content

Commit 81a02f6

Browse files
authored
Update tests to use the public entry point to the module (#171)
1 parent 39b253c commit 81a02f6

20 files changed

+144
-80
lines changed

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
"ruma",
1919
"nio"
2020
],
21-
"main": "pkg/index.js",
22-
"types": "pkg/index.d.ts",
21+
"exports": {
22+
".": {
23+
"types": "./pkg/index.d.ts",
24+
"default": "./pkg/index.js"
25+
}
26+
},
2327
"files": [
2428
"pkg/matrix_sdk_crypto_wasm_bg.wasm.js",
2529
"pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts",
@@ -30,20 +34,21 @@
3034
"@babel/core": "^7.23.5",
3135
"@babel/preset-env": "^7.23.5",
3236
"@babel/preset-typescript": "^7.23.3",
37+
"@tsconfig/node18": "^18.2.4",
3338
"@types/jest": "^29.5.10",
3439
"babel-jest": "^29.7.0",
3540
"cross-env": "^7.0.3",
3641
"eslint": "^8.55.0",
3742
"fake-indexeddb": "^4.0",
3843
"jest": "^28.1.0",
3944
"prettier": "^2.8.3",
40-
"typedoc": "^0.22.17",
41-
"typescript": "4.7",
45+
"typedoc": "^0.27.1",
46+
"typescript": "5.7.2",
4247
"wasm-pack": "^0.12.1",
4348
"yargs-parser": "~21.0.1"
4449
},
4550
"engines": {
46-
"node": ">= 10"
51+
"node": ">= 18"
4752
},
4853
"scripts": {
4954
"lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:types",

tests/asyncload.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { UserId, initAsync } = require("../pkg");
1+
const { UserId, initAsync } = require("@matrix-org/matrix-sdk-crypto-wasm");
22

33
test("can instantiate rust objects with async initialiser", async () => {
44
initUserId = () => new UserId("@foo:bar.org");

tests/attachment.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { Attachment, EncryptedAttachment } = require("../pkg");
1+
const { Attachment, EncryptedAttachment } = require("@matrix-org/matrix-sdk-crypto-wasm");
22

33
describe(Attachment.name, () => {
44
const originalData = "hello";

tests/backup.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { BackupDecryptionKey } = require("../pkg");
1+
const { BackupDecryptionKey } = require("@matrix-org/matrix-sdk-crypto-wasm");
22

33
const aMegolmKey = {
44
algorithm: "m.megolm.v1.aes-sha2",

tests/dehydrated_devices.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
RoomId,
1111
TrustRequirement,
1212
UserId,
13-
} from "../pkg/matrix_sdk_crypto_wasm";
13+
} from "@matrix-org/matrix-sdk-crypto-wasm";
1414
import "fake-indexeddb/auto";
1515

1616
afterEach(() => {

tests/device.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const {
2525
Qr,
2626
QrCode,
2727
QrCodeScan,
28-
} = require("../pkg");
28+
} = require("@matrix-org/matrix-sdk-crypto-wasm");
2929
const { zip, addMachineToMachine } = require("./helper");
30-
const { VerificationRequestPhase, QrState } = require("../pkg");
30+
const { VerificationRequestPhase, QrState } = require("@matrix-org/matrix-sdk-crypto-wasm");
3131

3232
// Uncomment to enable debug logging for tests
33-
//const { Tracing, LoggerLevel } = require("../pkg");
33+
//const { Tracing, LoggerLevel } = require("@matrix-org/matrix-sdk-crypto-wasm");
3434
//new Tracing(LoggerLevel.Trace).turnOn();
3535

3636
describe("LocalTrust", () => {

tests/ecies.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
const { Ecies, SecretsBundle, UserId, DeviceId, OlmMachine, RequestType } = require("../pkg/matrix_sdk_crypto_wasm");
1+
const {
2+
Ecies,
3+
SecretsBundle,
4+
UserId,
5+
DeviceId,
6+
OlmMachine,
7+
RequestType,
8+
} = require("@matrix-org/matrix-sdk-crypto-wasm");
29

310
describe(Ecies.name, () => {
411
test("can establish a channel and decrypt the initial message", () => {

tests/encryption.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const {
44
EncryptionSettings,
55
HistoryVisibility,
66
VerificationState,
7-
} = require("../pkg");
7+
} = require("@matrix-org/matrix-sdk-crypto-wasm");
88

99
describe("EncryptionAlgorithm", () => {
1010
test("has the correct variant values", () => {

tests/events.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { HistoryVisibility } = require("../pkg");
1+
const { HistoryVisibility } = require("@matrix-org/matrix-sdk-crypto-wasm");
22

33
describe("HistoryVisibility", () => {
44
test("has the correct variant values", () => {

tests/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("../pkg");
1+
const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("@matrix-org/matrix-sdk-crypto-wasm");
22

33
function* zip(...arrays) {
44
const len = Math.min(...arrays.map((array) => array.length));

0 commit comments

Comments
 (0)