mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
test(bluebubbles): accept native contact database paths
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user