mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-04-08 00:26:26 +00:00
- Added `get_public_key` method to mock identity in `test_auto_propagation_api.py`. - Updated `test_get_config_dict_basic` in `test_meshchat_coverage.py` to assert public key retrieval. - Introduced new tests for LXMA URI handling in `AppQrUri.test.js` and `ContactsPage.test.js`. - Enhanced `IdentitiesPage.test.js` to expose current identity details including LXMF address and message count. - Added routing tests for LXMA contact ingestion in `MessagesPage.test.js`.
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
import App from "../../meshchatx/src/frontend/components/App.vue";
|
|
|
|
vi.mock("qrcode", () => ({
|
|
default: {
|
|
toDataURL: vi.fn().mockResolvedValue("data:image/png;base64,abc123"),
|
|
},
|
|
}));
|
|
|
|
describe("App.vue QR and protocol URI handling", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("generates lxma QR URI when public key is available", async () => {
|
|
const ctx = {
|
|
config: {
|
|
lxmf_address_hash: "a".repeat(32),
|
|
identity_public_key: "b".repeat(128),
|
|
},
|
|
lxmfQrDataUrl: null,
|
|
showLxmfQr: false,
|
|
getMyIdentityUri: App.methods.getMyIdentityUri,
|
|
$t: (k) => k,
|
|
};
|
|
|
|
await App.methods.openLxmfQr.call(ctx);
|
|
|
|
expect(ctx.showLxmfQr).toBe(true);
|
|
expect(ctx.lxmfQrDataUrl).toBe("data:image/png;base64,abc123");
|
|
});
|
|
|
|
it("parses lxma protocol links and routes by destination hash", () => {
|
|
const push = vi.fn();
|
|
const ctx = {
|
|
$router: {
|
|
push,
|
|
},
|
|
};
|
|
const destinationHash = "c".repeat(32);
|
|
const publicKey = "d".repeat(128);
|
|
|
|
App.methods.handleProtocolLink.call(ctx, `lxma://${destinationHash}:${publicKey}`);
|
|
|
|
expect(push).toHaveBeenCalledWith({
|
|
name: "messages",
|
|
params: {
|
|
destinationHash,
|
|
},
|
|
});
|
|
});
|
|
});
|