(&mut self, id: &str, expected: JsonValue)
| 208 | } |
| 209 | |
| 210 | pub async fn assert_collab(&mut self, id: &str, expected: JsonValue) { |
| 211 | let object_id = |
| 212 | Uuid::parse_str(id).unwrap_or_else(|_| Uuid::new_v5(&Uuid::NAMESPACE_OID, id.as_bytes())); |
| 213 | let disk_plugin = disk_plugin_with_db( |
| 214 | self.uid, |
| 215 | self.workspace_id.clone(), |
| 216 | self.db.clone(), |
| 217 | &object_id.to_string(), |
| 218 | CollabType::Document, |
| 219 | ); |
| 220 | let data_source = KVDBCollabPersistenceImpl { |
| 221 | db: Arc::downgrade(&self.db), |
| 222 | uid: self.uid, |
| 223 | workspace_id: self.workspace_id.clone(), |
| 224 | }; |
| 225 | |
| 226 | let options = |
| 227 | CollabOptions::new(object_id, default_client_id()).with_data_source(data_source.into()); |
| 228 | let mut collab = Collab::new_with_options(CollabOrigin::Empty, options).unwrap(); |
| 229 | collab.add_plugin(Box::new(disk_plugin)); |
| 230 | collab.initialize(); |
| 231 | let json = collab.to_json_value(); |
| 232 | assert_json_diff::assert_json_eq!(json, expected); |
| 233 | } |
| 234 | |
| 235 | pub async fn undo(&mut self, id: &str) { |
| 236 | self |
no test coverage detected