max / synckit
- Co-Authored-By
- Claude Opus 5 (1M context) <noreply@anthropic.com>
1 file changed,
+22 insertions,
-0 deletions
| @@ -1152,6 +1152,28 @@ | |||
| 1152 | 1152 | assert_eq!(conflicts[0].remote.entry.row_id, "r1"); | |
| 1153 | 1153 | } | |
| 1154 | 1154 | ||
| 1155 | + | /// `row_keys` is what a caller pre-fetches committed clocks with, so it has | |
| 1156 | + | /// to name every clean row and nothing else, in the order the changes were | |
| 1157 | + | /// pulled. | |
| 1158 | + | #[test] | |
| 1159 | + | fn row_keys_names_every_clean_row_in_order() { | |
| 1160 | + | let our_device = Uuid::new_v4(); | |
| 1161 | + | let other_device = Uuid::new_v4(); | |
| 1162 | + | let now = Utc::now(); | |
| 1163 | + | ||
| 1164 | + | let remote = vec![ | |
| 1165 | + | make_pulled("tasks", "r1", ChangeOp::Update, now, other_device, 1), | |
| 1166 | + | make_pulled("events", "r2", ChangeOp::Insert, now, other_device, 2), | |
| 1167 | + | ]; | |
| 1168 | + | ||
| 1169 | + | let (clean, conflicts) = detect_conflicts(remote, &[], DeviceId::new(our_device)); | |
| 1170 | + | assert!(conflicts.is_empty()); | |
| 1171 | + | assert_eq!( | |
| 1172 | + | clean.row_keys().collect::<Vec<_>>(), | |
| 1173 | + | vec![("tasks", "r1"), ("events", "r2")] | |
| 1174 | + | ); | |
| 1175 | + | } | |
| 1176 | + | ||
| 1155 | 1177 | #[test] | |
| 1156 | 1178 | fn empty_remote_produces_no_conflicts() { | |
| 1157 | 1179 | let our_device = Uuid::new_v4(); |