add IndexResolver BatchHandler tests

This commit is contained in:
ad hoc 2022-06-02 12:15:36 +02:00
parent fbba67fbe9
commit b594d49def
No known key found for this signature in database
GPG Key ID: 4F00A782990CC643

View File

@ -608,14 +608,16 @@ mod test {
pub async fn process_document_addition_batch(&self, tasks: Vec<Task>) -> Vec<Task> { pub async fn process_document_addition_batch(&self, tasks: Vec<Task>) -> Vec<Task> {
match self { match self {
IndexResolver::Real(r) => r.process_document_addition_batch(tasks).await, IndexResolver::Real(r) => r.process_document_addition_batch(tasks).await,
IndexResolver::Mock(_) => todo!(), IndexResolver::Mock(m) => unsafe {
m.get("process_document_addition_batch").call(tasks)
},
} }
} }
pub async fn process_task(&self, task: &Task) -> Result<TaskResult> { pub async fn process_task(&self, task: &Task) -> Result<TaskResult> {
match self { match self {
IndexResolver::Real(r) => r.process_task(task).await, IndexResolver::Real(r) => r.process_task(task).await,
IndexResolver::Mock(_) => todo!(), IndexResolver::Mock(m) => unsafe { m.get("process_task").call(task) },
} }
} }
@ -665,7 +667,9 @@ mod test {
pub async fn delete_content_file(&self, content_uuid: Uuid) -> Result<()> { pub async fn delete_content_file(&self, content_uuid: Uuid) -> Result<()> {
match self { match self {
IndexResolver::Real(r) => r.delete_content_file(content_uuid).await, IndexResolver::Real(r) => r.delete_content_file(content_uuid).await,
IndexResolver::Mock(_) => todo!(), IndexResolver::Mock(m) => unsafe {
m.get("delete_content_file").call(content_uuid)
},
} }
} }
} }