test: move importer tests to tests/ (via DocumentParser)
This commit is contained in:
@@ -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