// Reads the real GNOME/EDS address books (read-only). Run with: LIVE=1 npm test import { describe, expect, it } from 'vitest' import { ContactDirectory, listSources } from '../src/main/contacts' describe.skipIf(!process.env.LIVE)('live EDS contacts', () => { it('lists enabled address books', async () => { const sources = await listSources() console.log(sources.map((s) => `${s.name} (${s.account})`).join('\n')) expect(sources.length).toBeGreaterThan(0) }) it('loads contacts with numbers and photos', async () => { const dir = new ContactDirectory() await dir.load() const all = dir.list() const withPhoto = all.filter((c) => c.photo) const byBook = new Map() for (const c of all) byBook.set(c.book, (byBook.get(c.book) ?? 0) + 1) console.log(`numbers: ${all.length}, with photo: ${withPhoto.length}`, Object.fromEntries(byBook)) const kinds = new Map() for (const c of withPhoto) { const k = dir.photoFor(c.number)!.kind kinds.set(k, (kinds.get(k) ?? 0) + 1) } console.log('photo kinds', Object.fromEntries(kinds)) expect(all.length).toBeGreaterThan(50) dir.close() }) })