From 1067abc665ce5f8a6722977bd692e11df30069b9 Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 16:16:20 +0100 Subject: [PATCH] test: check device identity pem blocks --- src/infra/device-identity.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/infra/device-identity.test.ts b/src/infra/device-identity.test.ts index bcdc85fb48d2..55898e3339b3 100644 --- a/src/infra/device-identity.test.ts +++ b/src/infra/device-identity.test.ts @@ -94,8 +94,14 @@ describe("device identity crypto helpers", () => { ).toBe(true); expect(stored.version).toBe(1); expect(stored.deviceId).toBe(SWIFT_RAW_DEVICE_ID); - expect(stored.publicKeyPem).toEqual(expect.stringContaining("BEGIN PUBLIC KEY")); - expect(stored.privateKeyPem).toEqual(expect.stringContaining("BEGIN PRIVATE KEY")); + expect(typeof stored.publicKeyPem).toBe("string"); + expect(typeof stored.privateKeyPem).toBe("string"); + const publicKeyPem = stored.publicKeyPem as string; + const privateKeyPem = stored.privateKeyPem as string; + expect(publicKeyPem.startsWith("-----BEGIN PUBLIC KEY-----\n")).toBe(true); + expect(publicKeyPem.endsWith("-----END PUBLIC KEY-----\n")).toBe(true); + expect(privateKeyPem.startsWith("-----BEGIN PRIVATE KEY-----\n")).toBe(true); + expect(privateKeyPem.endsWith("-----END PRIVATE KEY-----\n")).toBe(true); expect(stored.createdAtMs).toBe(1_700_000_000_000); expect(stored).not.toHaveProperty("publicKey"); expect(stored).not.toHaveProperty("privateKey");