Skip to content

Commit

Permalink
added in file type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CHRISCARLON committed Oct 3, 2024
1 parent aa866c4 commit afa47a2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
1 change: 1 addition & 0 deletions test_files/invalit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invalid file for testing
54 changes: 51 additions & 3 deletions tests/duckdb_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
// use duckdb_transformer::duckdb_load::duckdb_transform;
use duckdb_transformer::duckdb_load::process_file;
use std::path::Path;

const TEST_FILES_DIR: &str = "test_files";

fn test_file_path(file_name: &str) -> String {
Path::new(TEST_FILES_DIR)
.join(file_name)
.to_str()
.unwrap()
.to_string()
}

#[test]
fn test_process_geojson() {
let file_path = test_file_path("hotosm_twn_populated_places_points_geojson.geojson");
assert!(process_file(&file_path).is_ok());
}

#[test]
fn test_process_geopackage() {
let file_path = test_file_path("GLA_High_Street_boundaries.gpkg");
assert!(process_file(&file_path).is_ok());
}

// #[test]
// fn test_process_shapefile() {
// let file_path = test_file_path("your_shapefile.shp");
// assert!(process_file(&file_path).is_ok());
// }

// #[test]
// fn test_duckdb_transform() {
// assert!(duckdb_transform().is_ok())
// fn test_process_excel() {
// let file_path = test_file_path("your_excel_file.xlsx");
// assert!(process_file(&file_path).is_ok());
// }

// #[test]
// fn test_process_csv() {
// let file_path = test_file_path("your_csv_file.csv");
// assert!(process_file(&file_path).is_ok());
// }

// #[test]
// fn test_process_parquet() {
// let file_path = test_file_path("your_parquet_file.parquet");
// assert!(process_file(&file_path).is_ok());
// }

#[test]
fn test_process_invalid_file() {
let file_path = test_file_path("invalid.txt");
assert!(process_file(&file_path).is_err());
}

0 comments on commit afa47a2

Please sign in to comment.