From 981767516dc9a2ea5f86b1240a1f14cb0be025a2 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 4 May 2026 04:28:33 -0700 Subject: [PATCH] test(bluebubbles): accept native contact database paths --- .../src/participant-contact-names.test.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/extensions/bluebubbles/src/participant-contact-names.test.ts b/extensions/bluebubbles/src/participant-contact-names.test.ts index f415b30b4fb..0f0e132b114 100644 --- a/extensions/bluebubbles/src/participant-contact-names.test.ts +++ b/extensions/bluebubbles/src/participant-contact-names.test.ts @@ -1,3 +1,4 @@ +import { join } from "node:path"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { enrichBlueBubblesParticipantsWithContactNames, @@ -111,9 +112,17 @@ describe("enrichBlueBubblesParticipantsWithContactNames", () => { }); it("lists contacts databases from the current home directory", async () => { + const expectedSourcesDir = join( + "/Users/tester", + "Library", + "Application Support", + "AddressBook", + "Sources", + ); + const expectedDatabasePath = join(expectedSourcesDir, "source-a", "AddressBook-v22.abcddb"); const readdir = vi.fn(async () => ["source-a", "source-b"]); const access = vi.fn(async (path: string) => { - if (!path.endsWith("source-a/AddressBook-v22.abcddb")) { + if (path !== expectedDatabasePath) { throw new Error("missing"); } }); @@ -124,12 +133,8 @@ describe("enrichBlueBubblesParticipantsWithContactNames", () => { access, }); - expect(readdir).toHaveBeenCalledWith( - "/Users/tester/Library/Application Support/AddressBook/Sources", - ); - expect(databases).toEqual([ - "/Users/tester/Library/Application Support/AddressBook/Sources/source-a/AddressBook-v22.abcddb", - ]); + expect(readdir).toHaveBeenCalledWith(expectedSourcesDir); + expect(databases).toEqual([expectedDatabasePath]); }); it("queries only the requested phone keys in sqlite", async () => {