Skip to content

Commit

Permalink
test the output
Browse files Browse the repository at this point in the history
  • Loading branch information
TungstnBallon committed Jul 2, 2024
1 parent 7f6c747 commit 4a0a538
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import * as fs from 'node:fs';
import path from 'node:path';

import * as R from '@jvalue/jayvee-execution';
Expand Down Expand Up @@ -76,6 +77,12 @@ describe('Validation of CSVFileLoaderExecutor', () => {
});
afterEach(() => {
vi.clearAllMocks();
try {
fs.unlinkSync('test.csv');
} catch {
// INFO: This catch block is empty because the try block is just for cleanup
// operations. If it fails, execution can continue
}
});

it('should diagnose no error on valid loader config', async () => {
Expand Down Expand Up @@ -105,7 +112,10 @@ describe('Validation of CSVFileLoaderExecutor', () => {
expect(R.isErr(result)).toEqual(false);
if (R.isOk(result)) {
expect(result.right.ioType).toEqual(IOType.NONE);
// FIXME: Check that the resulting csv is valid
const expectedOutput = `Column1,Column2
value 1, 20.2`;
const actualOutput = fs.readFileSync('test.csv');
expect(expectedOutput).toEqual(actualOutput);
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pipeline TestPipeline {

block TestBlock oftype CSVFileLoaderExecutor {
file: "./test.csv";
delimiter: ',';
enclosing: '';
enclosingEscape: '';
}

TestExtractor
Expand Down

0 comments on commit 4a0a538

Please sign in to comment.