Skip to content

Commit

Permalink
Add test for searching xlsx file via Zip adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
letuanhai authored and lafrenierejm committed Sep 19, 2024
1 parent 80cbb9d commit afbf21e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Binary file added exampledir/test/excel.xlsx
Binary file not shown.
21 changes: 21 additions & 0 deletions src/adapters/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,25 @@ mod test {

Ok(())
}

#[tokio::test]
async fn search_xlsx_with_extension_config() -> Result<()> {
let zip = test_data_dir().join("excel.xlsx");
let (a, d) = simple_fs_adapt_info(&zip).await?;
let v = adapted_to_vec(
loop_adapt(
&ZipAdapter {
extensions: vec![String::from("xlsx")],
mimetypes: Vec::new(),
},
d,
a,
)
.await?,
)
.await?;
assert_eq!(String::from_utf8(v[..18].to_vec())?, "PREFIX:_rels/.rels"); // first filename in the spreadsheet archive

Ok(())
}
}

0 comments on commit afbf21e

Please sign in to comment.