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 () => {