refactor/tighten-architecture #26
@@ -79,7 +79,3 @@ fn set_field(row: &mut ImportRow, field: &DomainField, value: String) {
|
||||
DomainField::ExternalMetadataId => row.external_metadata_id = Some(value),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tests/mapper.rs"]
|
||||
mod tests;
|
||||
|
||||
@@ -7,7 +7,3 @@ pub use csv::parse_csv;
|
||||
pub use json::parse_json;
|
||||
#[cfg(feature = "xlsx")]
|
||||
pub use xlsx::parse_xlsx;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "tests.rs"]
|
||||
mod tests;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
use super::*;
|
||||
use domain::models::{DomainField, FieldMapping, ParsedFile, RowResult, Transform};
|
||||
use domain::models::{AnnotatedRow, DomainField, FieldMapping, ParsedFile, RowResult, Transform};
|
||||
use domain::ports::DocumentParser;
|
||||
use importer::ImporterDocumentParser;
|
||||
|
||||
fn apply_mapping(file: &ParsedFile, mappings: &[FieldMapping]) -> Vec<AnnotatedRow> {
|
||||
ImporterDocumentParser.apply_mapping(file, mappings)
|
||||
}
|
||||
|
||||
fn sample_file() -> ParsedFile {
|
||||
ParsedFile {
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
use super::*;
|
||||
use domain::{
|
||||
models::{FileFormat, ParsedFile},
|
||||
ports::DocumentParser,
|
||||
};
|
||||
use importer::ImporterDocumentParser;
|
||||
|
||||
fn parse_csv(data: &[u8]) -> Result<ParsedFile, domain::models::ImportError> {
|
||||
ImporterDocumentParser.parse(data, FileFormat::Csv)
|
||||
}
|
||||
|
||||
fn parse_json(data: &[u8]) -> Result<ParsedFile, domain::models::ImportError> {
|
||||
ImporterDocumentParser.parse(data, FileFormat::Json)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn csv_parses_headers_and_rows() {
|
||||
|
||||
Reference in New Issue
Block a user