fix(sites): remove stale domain links on sync (#110)
Some checks are pending
CI / build (push) Waiting to run
deploy / deploy (push) Waiting to run
test / test (push) Waiting to run

This commit is contained in:
RissRIce 2026-08-09 22:56:39 -06:00 committed by GitHub
parent b48608c4e9
commit bf777a1475
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 0 deletions

View file

@ -111,6 +111,31 @@ func TestManagerAddRemoveSyncAsk(t *testing.T) {
}
}
func TestSyncRemovesStaleDomainEntries(t *testing.T) {
dir := t.TempDir()
st, err := store.Open(filepath.Join(dir, "test.db"))
if err != nil {
t.Fatal(err)
}
defer st.Close()
m, err := NewManager(st, dir)
if err != nil {
t.Fatal(err)
}
stale := filepath.Join(dir, "domains", "stale.example.com")
if err := os.WriteFile(stale, []byte("stale"), 0o644); err != nil {
t.Fatal(err)
}
if err := m.Sync(); err != nil {
t.Fatal(err)
}
if _, err := os.Lstat(stale); !os.IsNotExist(err) {
t.Errorf("expected stale domain entry removed, got err=%v", err)
}
}
func TestAskUserSubdomain(t *testing.T) {
t.Setenv("AGENTBBS_HOST", "bbs.profullstack.com")
dir := t.TempDir()