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

Update tests to use the public entry point to the module #171

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
"ruma",
"nio"
],
"main": "pkg/index.js",
"types": "pkg/index.d.ts",
"exports": {
".": {
"types": "./pkg/index.d.ts",
"default": "./pkg/index.js"
}
},
"files": [
"pkg/matrix_sdk_crypto_wasm_bg.wasm.js",
"pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tests/asyncload.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { UserId, initAsync } = require("../pkg");
const { UserId, initAsync } = require("@matrix-org/matrix-sdk-crypto-wasm");

test("can instantiate rust objects with async initialiser", async () => {
initUserId = () => new UserId("@foo:bar.org");
Expand Down
2 changes: 1 addition & 1 deletion tests/attachment.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Attachment, EncryptedAttachment } = require("../pkg");
const { Attachment, EncryptedAttachment } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(Attachment.name, () => {
const originalData = "hello";
Expand Down
2 changes: 1 addition & 1 deletion tests/backup.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { BackupDecryptionKey } = require("../pkg");
const { BackupDecryptionKey } = require("@matrix-org/matrix-sdk-crypto-wasm");

const aMegolmKey = {
algorithm: "m.megolm.v1.aes-sha2",
Expand Down
2 changes: 1 addition & 1 deletion tests/dehydrated_devices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
RoomId,
TrustRequirement,
UserId,
} from "../pkg/matrix_sdk_crypto_wasm";
} from "@matrix-org/matrix-sdk-crypto-wasm";

Check failure on line 13 in tests/dehydrated_devices.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module '@matrix-org/matrix-sdk-crypto-wasm' or its corresponding type declarations.
import "fake-indexeddb/auto";

afterEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions tests/device.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const {
Qr,
QrCode,
QrCodeScan,
} = require("../pkg");
} = require("@matrix-org/matrix-sdk-crypto-wasm");
const { zip, addMachineToMachine } = require("./helper");
const { VerificationRequestPhase, QrState } = require("../pkg");
const { VerificationRequestPhase, QrState } = require("@matrix-org/matrix-sdk-crypto-wasm");

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

describe("LocalTrust", () => {
Expand Down
9 changes: 8 additions & 1 deletion tests/ecies.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const { Ecies, SecretsBundle, UserId, DeviceId, OlmMachine, RequestType } = require("../pkg/matrix_sdk_crypto_wasm");
const {
Ecies,
SecretsBundle,
UserId,
DeviceId,
OlmMachine,
RequestType,
} = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(Ecies.name, () => {
test("can establish a channel and decrypt the initial message", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/encryption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {
EncryptionSettings,
HistoryVisibility,
VerificationState,
} = require("../pkg");
} = require("@matrix-org/matrix-sdk-crypto-wasm");

describe("EncryptionAlgorithm", () => {
test("has the correct variant values", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/events.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { HistoryVisibility } = require("../pkg");
const { HistoryVisibility } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe("HistoryVisibility", () => {
test("has the correct variant values", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("../pkg");
const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("@matrix-org/matrix-sdk-crypto-wasm");

function* zip(...arrays) {
const len = Math.min(...arrays.map((array) => array.length));
Expand Down
2 changes: 1 addition & 1 deletion tests/identifiers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
RoomId,
ServerName,
UserId,
} = require("../pkg");
} = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(UserId.name, () => {
test("cannot be invalid", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/libolm_migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
StoreHandle,
Tracing,
UserId,
} from "../pkg";
} from "@matrix-org/matrix-sdk-crypto-wasm";

Check failure on line 29 in tests/libolm_migration.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module '@matrix-org/matrix-sdk-crypto-wasm' or its corresponding type declarations.

beforeAll(() => {
new Tracing(LoggerLevel.Trace).turnOn();
Expand Down
2 changes: 1 addition & 1 deletion tests/machine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
OtherUserIdentity,
VerificationRequest,
Versions,
} from "../pkg";
} from "@matrix-org/matrix-sdk-crypto-wasm";

Check failure on line 39 in tests/machine.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module '@matrix-org/matrix-sdk-crypto-wasm' or its corresponding type declarations.
import "fake-indexeddb/auto";
import * as crypto from "node:crypto";

Expand Down
2 changes: 1 addition & 1 deletion tests/qr_code.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { QrCodeData, QrCodeMode, Curve25519PublicKey } = require("../pkg/matrix_sdk_crypto_wasm");
const { QrCodeData, QrCodeMode, Curve25519PublicKey } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(QrCodeData.name, () => {
test("can parse the QR code bytes from the MSC", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
SignatureUploadRequest,
RoomMessageRequest,
KeysBackupRequest,
} = require("../pkg");
} = require("@matrix-org/matrix-sdk-crypto-wasm");

describe("RequestType", () => {
test("has the correct variant values", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/sync_events.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { DeviceLists, UserId } = require("../pkg");
const { DeviceLists, UserId } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(DeviceLists.name, () => {
test("can be empty", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/tracing.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Tracing, LoggerLevel, OlmMachine, UserId, DeviceId } = require("../pkg");
const { Tracing, LoggerLevel, OlmMachine, UserId, DeviceId } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe("LoggerLevel", () => {
test("has the correct variant values", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/vodozemac_types.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Curve25519PublicKey } = require("../pkg");
const { Curve25519PublicKey } = require("@matrix-org/matrix-sdk-crypto-wasm");

describe(Curve25519PublicKey.name, () => {
test("Can create a Curve25519PublicKey from a base64 string", async () => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@tsconfig/node18/tsconfig.json",

Check failure on line 2 in tsconfig.json

View workflow job for this annotation

GitHub Actions / test

File '@tsconfig/node18/tsconfig.json' not found.
"compilerOptions": {
"strict": true
"lib": ["DOM"]
},
"typedocOptions": {
"entryPoints": ["pkg/matrix_sdk_crypto_wasm.d.ts"],
Expand Down
Loading