╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │264 const event_id_to_views_cursor = try haxy.getCursor(hash.hashInt(repo_opts.hash, "event-id->views")) orelse return error.NotFound; │ │265 const event_id_to_views = try Repo.DB.HashMap(.read_only).init(event_id_to_views_cursor); │ │266 │ │252 - // make sure all events have been processed │ │253 - var count: usize = 0; │ │254 - var event_id_to_views_iter = try event_id_to_views.iterator(); │ │255 - while (try event_id_to_views_iter.next()) |kv_pair_cursor| { │ │256 - _ = try kv_pair_cursor.readKeyValuePair(); │ │257 - count += 1; │ │267 + // make sure the issue from the first event was correctly edited │ │268 + { │ │269 + // get the last event id │ │270 + const last_event_id_cursor = try haxy.getCursor(hash.hashInt(repo_opts.hash, "last-event-id")) orelse return error.NotFound; │ │271 + var last_event_id_buffer: [event_id_size]u8 = undefined; │ │272 + _ = try last_event_id_cursor.readBytes(&last_event_id_buffer); │ │273 + │ │274 + // get the latest views (the views generated by the last event id) │ │275 + const views_cursor = try event_id_to_views.getCursor(hash.hashInt(repo_opts.hash, &last_event_id_buffer)) orelse return error.NotFound; │ │276 + const views = try Repo.DB.HashMap(.read_only).init(views_cursor); │ │277 + │ │278 + // get the map of issues │ │279 + const event_id_to_issue_cursor = try views.getCursor(hash.hashInt(repo_opts.hash, "event-id->issue")) orelse return error.NotFound; │ │280 + const event_id_to_issue = try Repo.DB.HashMap(.read_only).init(event_id_to_issue_cursor); │ │281 + │ │282 + // get the issue out of the map that was edited │ │283 + const first_issue_cursor = try event_id_to_issue.getCursor(hash.hashInt(repo_opts.hash, &first_event_id)) orelse return error.NotFound; │ │284 + const first_issue = try Repo.DB.HashMap(.read_only).init(first_issue_cursor); │ │285 + │ │286 + // make sure the issue's description was correctly edited │ │287 + const first_issue_description_cursor = try first_issue.getCursor(hash.hashInt(repo_opts.hash, "description")) orelse return error.NotFound;│ │288 + const first_issue_description_value = try first_issue_description_cursor.readBytesAlloc(allocator, null); │ │289 + defer allocator.free(first_issue_description_value); │ │290 + try std.testing.expectEqualStrings(events_to_process[1].data.issue.description, first_issue_description_value); │ │291 } │ │259 - try std.testing.expectEqual(events_to_process.len, count); │ │292 } │ │293 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯