Artifact dc03cad4ffac94eac3fdcd5e572decf4229c96d9f62a7addae01a40411b69c23:
- File
leaf/agent/notify/device_registry_test.go
— part of check-in
[38efed7a12]
at
2026-08-12 20:50:57
on branch main
— chore(deps): migrate to go-libfossil v0.9.0 (#195)
* chore(deps): migrate to go-libfossil v0.9.0 (renamed module path)
- import path danmestas/libfossil → danmestas/go-libfossil everywhere - CloneOpts.ProjectCode removed upstream; assert via CloneResult instead - Timeline now takes TimelineOpts (cursor pagination, newest-first) - testutil.HasFossil removed; check FossilBinary() != ""
* ci: retrigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (user: [email protected], size: 1327) [annotate] [blame] [check-ins using]
package notify import ( "testing" "time" _ "github.com/danmestas/go-libfossil/db/driver/modernc" ) func TestDeviceRegistryCRUD(t *testing.T) { r := createTestRepo(t) // Initially empty. devices, err := ListDevices(r) if err != nil { t.Fatal(err) } if len(devices) != 0 { t.Fatalf("expected 0 devices, got %d", len(devices)) } // Add a device. dev := Device{ Name: "dan-iphone", EndpointID: "iroh-endpoint-abc123", PairedAt: time.Now().UTC().Truncate(time.Second), } if err := AddDevice(r, dev); err != nil { t.Fatal(err) } devices, err = ListDevices(r) if err != nil { t.Fatal(err) } if len(devices) != 1 { t.Fatalf("expected 1 device, got %d", len(devices)) } if devices[0].Name != "dan-iphone" { t.Errorf("name = %q", devices[0].Name) } // Duplicate name rejected. if err := AddDevice(r, dev); err == nil { t.Error("expected error for duplicate device name") } // Remove. if err := RemoveDevice(r, "dan-iphone"); err != nil { t.Fatal(err) } devices, err = ListDevices(r) if err != nil { t.Fatal(err) } if len(devices) != 0 { t.Fatalf("expected 0 devices after remove, got %d", len(devices)) } // Remove non-existent = error. if err := RemoveDevice(r, "nonexistent"); err == nil { t.Error("expected error for removing non-existent device") } }