fix: IndexNow hears of deleted and edited records
RecordDeleted marks the listed rows it excludes and RecordSaved the rows whose lastmod it moves (indexnow_pending_at); the next rebuild sends them to IndexNow as removed or changed and clears the marks. RecordSaved checks for a nil event before reading it. TestIndexNow now deletes and edits through the record events, as the admin does.
This commit is contained in:
@@ -100,3 +100,14 @@ func testConfig(t *testing.T) *compass.Config {
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// TestRecordSavedNilEvent pins L2 IN-01: a nil event is ignored before it
|
||||
// is read.
|
||||
func TestRecordSavedNilEvent(t *testing.T) {
|
||||
if err := RecordSaved(t.Context(), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := RecordDeleted(t.Context(), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user