import assert from 'node:assert/strict' import { beforeEach,test } from 'node:test' import { fixture as f,reset } from './helpers/runtime.ts' const status=(await import('../status.ts')).default const request=(await import('../request.ts')).default beforeEach(reset) test('status opens metadata only; configured is not proof of a successful call',async()=>{ const result=await status();assert.equal(result.connected,true);assert.equal(result.ready,false);assert.equal(result.setupState,'configured');assert.equal(f.fetches,0) assert.deepEqual(Object.keys(result).sort(),['archiveEnabled','archiveReady','connected','connectedAt','deleteLoginOnWebsite','deviceName','locale','nextAllowedAt','ok','ready','reconnectNeeded','setupState','waitReason','workingSince']) await request({path:'/1.0/library'});assert.equal((await status()).ready,true) }) test('missing mapping and disconnected row report setup needed',async()=>{ f.mapped=false;assert.equal((await status()).connected,false) f.mapped=true;f.disconnected=true;assert.equal((await status()).connected,false) }) test('description supplies optional device facts; no local device record is required',async()=>{ f.description=JSON.stringify({registration:'00000000-0000-4000-8000-000000000001',deviceName:'Test device',serial:'TEST',registeredAt:'2026-10-30T00:00:00Z'}) const result=await status();assert.equal(result.deviceName,'Test device');assert.equal(result.locale,'ca') assert.equal(f.store.has('device-v1'),false) })