import XCTest @testable import LChatCore // Drift gate for the notification extension's decrypt path: a push payload's // blob (produced by the web crypto) must open with GroupKey exactly as the NSE // does it. A failure means the NSE would fall back to the generic banner for // every push — the wire format drifted from crypto.js. final class PushBlobDecryptTests: XCTestCase { struct Vector: Decodable { let keyB64: String let blob: String let expectName: String let expectText: String } struct Payload: Decodable { let name: String? let text: String? } func testPushBlobDecryptsLikeTheNSE() throws { let v = try fixture(Vector.self, "push-blob-vector") let raw = try XCTUnwrap(Data(base64urlEncoded: v.keyB64), "fixture key is not valid base64url") let key = try GroupKey(rawKey: raw) let payload = try key.decryptJSON(Payload.self, blob: v.blob) XCTAssertEqual(payload.name, v.expectName) XCTAssertEqual(payload.text, v.expectText) } }