From 929b7101afd1516c0e82492f02baf66049751ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:18:20 +0200 Subject: [PATCH 01/25] Added util to read local test xlsx file to Workbook/Sheet type --- libs/extensions/tabular/exec/test/util.ts | 39 +++++++++++++++++++ .../tabular/exec/tsconfig.spec.json | 3 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 libs/extensions/tabular/exec/test/util.ts diff --git a/libs/extensions/tabular/exec/test/util.ts b/libs/extensions/tabular/exec/test/util.ts new file mode 100644 index 000000000..3ee482362 --- /dev/null +++ b/libs/extensions/tabular/exec/test/util.ts @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import { Workbook } from '@jvalue/jayvee-execution'; +import * as exceljs from 'exceljs'; + +export async function createWorkbookFromLocalExcelFile( + fileName: string, +): Promise { + const workBookFromFile = new exceljs.Workbook(); + await workBookFromFile.xlsx.readFile(path.resolve(__dirname, fileName)); + + const workbook = new Workbook(); + + workBookFromFile.eachSheet((workSheet) => { + const workSheetDataArray: string[][] = []; + workSheet.eachRow((row, rowNumber) => { + const cellValues: string[] = []; + + // ExcelJS Rows and Columns are indexed from 1 + // We reduce their index to match Sheets being zero indexed + row.eachCell( + { includeEmpty: true }, + (cell: exceljs.Cell, colNumber: number) => { + cellValues[colNumber - 1] = cell.text; + }, + ); + + workSheetDataArray[rowNumber - 1] = cellValues; + }); + + workbook.addSheet(workSheetDataArray, workSheet.name); + }); + + return workbook; +} diff --git a/libs/extensions/tabular/exec/tsconfig.spec.json b/libs/extensions/tabular/exec/tsconfig.spec.json index 6668655fc..ab8d1573c 100644 --- a/libs/extensions/tabular/exec/tsconfig.spec.json +++ b/libs/extensions/tabular/exec/tsconfig.spec.json @@ -9,6 +9,7 @@ "jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", - "src/**/*.d.ts" + "src/**/*.d.ts", + "test/**/*.ts" ] } From 01ef6313525745a79dd7dc0498dc64af2868998f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:19:29 +0200 Subject: [PATCH 02/25] Added tests for cell-range-selector --- .../lib/cell-range-selector-executor.spec.ts | 178 ++++++++++++++++++ .../test-A1:C16.xlsx | Bin 0 -> 5904 bytes .../test-B1:C2.xlsx | Bin 0 -> 6085 bytes .../test-empty.xlsx | Bin 0 -> 5410 bytes .../valid-A1:A4.jv | 18 ++ .../valid-A1:C*.jv | 18 ++ .../valid-A1:E4.jv | 18 ++ 7 files changed, 232 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-B1:C2.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-empty.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv diff --git a/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts new file mode 100644 index 000000000..5eb544fd7 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts @@ -0,0 +1,178 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { CellRangeSelectorExecutor } from './cell-range-selector-executor'; + +describe('Validation of CellRangeSelectorExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/cell-range-selector-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/cell-range-selector-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Sheet, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new CellRangeSelectorExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid selector', async () => { + const text = readJvTestAsset('valid-A1:C*.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['0', 'Test', 'true']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['0', 'Test', 'true'], + ['1', 'Test', 'false'], + ['15', 'Test', 'true'], + ]), + ); + } + }); + + it('should diagnose no error on empty column', async () => { + const text = readJvTestAsset('valid-A1:C*.jv'); + + const testWorkbook = await readTestWorkbook('test-B1:C2.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(2); + expect(result.right.getHeaderRow()).toEqual(['', 'Test', 'true']); + expect(result.right.getData()).toEqual([ + ['', 'Test', 'true'], + ['', 'Test', 'false'], + ]); + } + }); + + it('should diagnose no error on selector out of bounds', async () => { + const text = readJvTestAsset('valid-A1:E4.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified cell range does not fit the sheet', + ); + } + }); + + it('should diagnose no error on selector on empty sheet', async () => { + const text = readJvTestAsset('valid-A1:C*.jv'); + + const testWorkbook = await readTestWorkbook('test-empty.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified cell range does not fit the sheet', + ); + } + }); + + it('should diagnose no error on single column selector on empty sheet', async () => { + const text = readJvTestAsset('valid-A1:A4.jv'); + + const testWorkbook = await readTestWorkbook('test-empty.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified cell range does not fit the sheet', + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..0544fa2814c07cf9c2736a400489785567ac1b4d GIT binary patch literal 5904 zcmaJ_WmJ^y)}~`dx{>ZqDQN_yK|-WMha4Cfy1To(q?GOs2?6OwK)OSalo0s9_ghDf z=N$K}_00UZ_kQNS_O(-44jus)1_cELCV^K&1LlDM?|$n;L10^Uw)VU$D_al zcR-HoYPCP-^EAD_tU9hnAG@=#vr^xFKrC+<0=MW5oW@q)$}+`j5Q7o${2Q0U1{_NAyszj z9W2+FxyIJ$Z9({1U_L)F;b?=IV1TVoO;!HX~?qCE8ADNa0TBe{$ILc2^^0Z*EQW{2Ab>XhVW%Bo^NP7mS| zVrLuRH$i1NWE6`w2ZY7DTT8&fz$pJuT!`;ZIDy&!fyNO6wJ?G}EZCeZ!T-RdB7O%G zX7eVV(Lv2#uAd6aCN`iUe;eMfxmF%5W6EcFbXBNeN`jJ&oY^&CZW3VFKWVe|iT?Rc zv#Ro20TjFL>2wP`x4nf7Jp=W@KGw68ae_)+if9KC#`1w>by+TaWQAmmt+Cugn~^jF zFlfZMOgrvaNWYJN%4_GjD%c#+MwNiVp}^~Q^h{x#NXONdaO98__}PpgHYS0N$Q;L`mIDpKM*7;=ZaH6msf`I! zZ};r&*(&gO1->R14V~iCy|&1N)zVIfFO<>JA(4@5$447#atA2gfD$A82>1=}K6}au zHseLI@zFGA{064_34oCUQoq%!gM<>^EBW1)7Z-iq#S&orR>(2H+^VM$Rw`O0HHA9a zcyq2Bh8>LPRdYfwj(NdD5ORtFJQgKvWRXIDoK9}8{Kc0riX^zDMDopyxh4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N-6&2{uf!>ULz#^wTBzvUv3^Y#VTqgwK#S;1NI`6-z){ zx@Ik}gy$_0^4EKhnQ;Igb^)UJS>cixTIb@A{j=n0k~V@I%1HejcYU$g{??53c|eks z!HC{?1kFBsfaL!6XYnHq3fq~jy=f$yziVNT!zBIbxiB}17m|kC^)~MF@69Oa{Cios zx&3;ncrBe@jr-3?zKPdRX+`ku%!}a?T4<$=S{R#qOsqy@WaD!%HCP~_vy4dUMwosdZ%iRIXm2lHoG^AA1hAV_N*_>VJ&31mXQy#-85HDd z;^d5EX1L;xn4AKe3Ck>rxIAJa%oBcamoirFaGFKebF%{DU* zyRQ-!^TKceG&o-#ZV!I&Uf|}%sU-QEChH%Gs(e(}&m{yZ?ZYI&JtZ|f23arC2I$r5V5j;M* z_><1>vKEX^D9@lnKaaC=0uSPfKRXa$MAK3$)9mAGm4B#B=ud1zfmc3RWvRn_gY2kH zk0`X*3Y@cB|0r(%Fd)y{KDm02fI(uq`H=40XQKsH;n*#mW2l)4rhRtcQ@YJuCxa&8 zNkOviv2C0_W6r`)@>35PicuC@;k?rbJoOOZ0xjOzIO_Za=5!qO-*Rp^^}FKvDaGl4 z=1h2SOa1$}=65^iJJ-{h#+k_A@(a$+`3cAG%I8~>Q-+<18^JH--&@_^4VeGM!1Ab`qLI3~& literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv new file mode 100644 index 000000000..666e6e2ef --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype CellRangeSelector { + select: range A1:A4; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv new file mode 100644 index 000000000..9f6c914be --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype CellRangeSelector { + select: range A1:C*; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv new file mode 100644 index 000000000..605210d2d --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype CellRangeSelector { + select: range A1:E4; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From 6c264f916622db63e0062677c4afe0ebce960fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:19:52 +0200 Subject: [PATCH 03/25] Added fix for 'structuredclone is not defined' --- libs/extensions/tabular/exec/jest.config.ts | 1 + .../tabular/exec/src/jsdom-environment-fix.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/jsdom-environment-fix.ts diff --git a/libs/extensions/tabular/exec/jest.config.ts b/libs/extensions/tabular/exec/jest.config.ts index e593333a4..9844a26bb 100644 --- a/libs/extensions/tabular/exec/jest.config.ts +++ b/libs/extensions/tabular/exec/jest.config.ts @@ -5,6 +5,7 @@ export default { displayName: 'extensions-tabular-exec', preset: '../../../../jest.preset.js', + testEnvironment: './src/jsdom-environment-fix.ts', globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json', diff --git a/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts b/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts new file mode 100644 index 000000000..c18ba7718 --- /dev/null +++ b/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import JSDOMEnvironment from 'jest-environment-jsdom'; + +// https://github.com/jsdom/jsdom/issues/3363 +export default class FixJSDOMEnvironment extends JSDOMEnvironment { + constructor(...args: ConstructorParameters) { + super(...args); + + this.global.structuredClone = structuredClone; + } +} From f5fe0aac9a55e2d8c6e31a94ff7d502ce21262be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:20:14 +0200 Subject: [PATCH 04/25] Added tests for cell-writer --- .../exec/src/lib/cell-writer-executor.spec.ts | 147 ++++++++++++++++++ .../cell-writer-executor/test-A1:C16.xlsx | Bin 0 -> 5904 bytes .../cell-writer-executor/test-empty.xlsx | Bin 0 -> 5410 bytes .../valid-cell-range-writer.jv | 19 +++ .../valid-single-cell-writer.jv | 19 +++ 5 files changed, 185 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-empty.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv diff --git a/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts new file mode 100644 index 000000000..5f843e392 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts @@ -0,0 +1,147 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { CellWriterExecutor } from './cell-writer-executor'; + +describe('Validation of CellWriterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/cell-writer-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/cell-writer-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Sheet, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new CellWriterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid single cell writer', async () => { + const text = readJvTestAsset('valid-single-cell-writer.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['16', 'Test', 'true']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['16', 'Test', 'true'], + ['1', 'Test', 'false'], + ['15', 'Test', 'true'], + ]), + ); + } + }); + + it('should diagnose no error on valid cell range writer', async () => { + const text = readJvTestAsset('valid-cell-range-writer.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['16', 'Test2', '']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['16', 'Test2', ''], + ['1', 'Test', 'false'], + ['15', 'Test', 'true'], + ]), + ); + } + }); + + it('should diagnose no error on single cell writer on empty sheet', async () => { + const text = readJvTestAsset('valid-single-cell-writer.jv'); + + const testWorkbook = await readTestWorkbook('test-empty.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'Some specified cells do not exist in the sheet', + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..0544fa2814c07cf9c2736a400489785567ac1b4d GIT binary patch literal 5904 zcmaJ_WmJ^y)}~`dx{>ZqDQN_yK|-WMha4Cfy1To(q?GOs2?6OwK)OSalo0s9_ghDf z=N$K}_00UZ_kQNS_O(-44jus)1_cELCV^K&1LlDM?|$n;L10^Uw)VU$D_al zcR-HoYPCP-^EAD_tU9hnAG@=#vr^xFKrC+<0=MW5oW@q)$}+`j5Q7o${2Q0U1{_NAyszj z9W2+FxyIJ$Z9({1U_L)F;b?=IV1TVoO;!HX~?qCE8ADNa0TBe{$ILc2^^0Z*EQW{2Ab>XhVW%Bo^NP7mS| zVrLuRH$i1NWE6`w2ZY7DTT8&fz$pJuT!`;ZIDy&!fyNO6wJ?G}EZCeZ!T-RdB7O%G zX7eVV(Lv2#uAd6aCN`iUe;eMfxmF%5W6EcFbXBNeN`jJ&oY^&CZW3VFKWVe|iT?Rc zv#Ro20TjFL>2wP`x4nf7Jp=W@KGw68ae_)+if9KC#`1w>by+TaWQAmmt+Cugn~^jF zFlfZMOgrvaNWYJN%4_GjD%c#+MwNiVp}^~Q^h{x#NXONdaO98__}PpgHYS0N$Q;L`mIDpKM*7;=ZaH6msf`I! zZ};r&*(&gO1->R14V~iCy|&1N)zVIfFO<>JA(4@5$447#atA2gfD$A82>1=}K6}au zHseLI@zFGA{064_34oCUQoq%!gM<>^EBW1)7Z-iq#S&orR>(2H+^VM$Rw`O0HHA9a zcyq2Bh8>LPRdYfwj(NdD5ORtFJQgKvWRXIDoK9}8{Kc0riX^zDMDopyxh4Qr$^97_ zBxSgnZWc9B;8>%qx{a89_2OnE_v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K@YS+GDrSB#v%rXoVK$(Ufe*x5-l7MZD;z~%T3(NcmDD3a?2`1W6QK;Y z$XFt@h6uE<(7Pv8L8dZtK7|Kn)jG-mobMBoomnrXuaIHiPBk}h@4i~POy|zP6GVI9 z{*sJm4VL&WZ3}$t)g->YU_vk8uW8oXtlO93CB5Fo64C=da$0MiImyez6X|;DrtJPol2&2bh`CP~;_*oX zq6BPJl!UawZv1pLzysN-6&2{uf!>ULz#^wTBzvUv3^Y#VTqgwK#S;1NI`6-z){ zx@Ik}gy$_0^4EKhnQ;Igb^)UJS>cixTIb@A{j=n0k~V@I%1HejcYU$g{??53c|eks z!HC{?1kFBsfaL!6XYnHq3fq~jy=f$yziVNT!zBIbxiB}17m|kC^)~MF@69Oa{Cios zx&3;ncrBe@jr-3?zKPdRX+`ku%!}a?T4<$=S{R#qOsqy@WaD!%HCP~_vy4dUMwosdZ%iRIXm2lHoG^AA1hAV_N*_>VJ&31mXQy#-85HDd z;^d5EX1L;xn4AKe3Ck>rxIAJa%oBcamoirFaGFKebF%{DU* zyRQ-!^TKceG&o-#ZV!I&Uf|}%sU-QEChH%Gs(e(}&m{yZ?ZYI&JtZ|f23arC2I$r5V5j;M* z_><1>vKEX^D9@lnKaaC=0uSPfKRXa$MAK3$)9mAGm4B#B=ud1zfmc3RWvRn_gY2kH zk0`X*3Y@cB|0r(%Fd)y{KDm02fI(uq`H=40XQKsH;n*#mW2l)4rhRtcQ@YJuCxa&8 zNkOviv2C0_W6r`)@>35PicuC@;k?rbJoOOZ0xjOzIO_Za=5!qO-*Rp^^}FKvDaGl4 z=1h2SOa1$}=65^iJJ-{h#+k_A@(a$+`3cAG%I8~>Q-+<18^JH--&@_^4VeGM!1Ab`qLI3~& literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv new file mode 100644 index 000000000..4ce5bece6 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype CellWriter { + write: ["16", "Test2", ""]; + at: range A1:C1; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv new file mode 100644 index 000000000..a7390b52e --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype CellWriter { + write: ["16"]; + at: cell A1; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From f7db0e343f959db6de00442d90f9e2b9c1449318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:27:34 +0200 Subject: [PATCH 05/25] Fixed test names --- .../exec/src/lib/cell-range-selector-executor.spec.ts | 6 +++--- .../tabular/exec/src/lib/cell-writer-executor.spec.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts index 5eb544fd7..a230f3356 100644 --- a/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts @@ -125,7 +125,7 @@ describe('Validation of CellRangeSelectorExecutor', () => { } }); - it('should diagnose no error on selector out of bounds', async () => { + it('should diagnose error on selector out of bounds', async () => { const text = readJvTestAsset('valid-A1:E4.jv'); const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); @@ -142,7 +142,7 @@ describe('Validation of CellRangeSelectorExecutor', () => { } }); - it('should diagnose no error on selector on empty sheet', async () => { + it('should diagnose error on selector on empty sheet', async () => { const text = readJvTestAsset('valid-A1:C*.jv'); const testWorkbook = await readTestWorkbook('test-empty.xlsx'); @@ -159,7 +159,7 @@ describe('Validation of CellRangeSelectorExecutor', () => { } }); - it('should diagnose no error on single column selector on empty sheet', async () => { + it('should diagnose error on single column selector on empty sheet', async () => { const text = readJvTestAsset('valid-A1:A4.jv'); const testWorkbook = await readTestWorkbook('test-empty.xlsx'); diff --git a/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts index 5f843e392..28479475f 100644 --- a/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts @@ -128,7 +128,7 @@ describe('Validation of CellWriterExecutor', () => { } }); - it('should diagnose no error on single cell writer on empty sheet', async () => { + it('should diagnose error on single cell writer on empty sheet', async () => { const text = readJvTestAsset('valid-single-cell-writer.jv'); const testWorkbook = await readTestWorkbook('test-empty.xlsx'); From 024f6d3461397426bd47deeb3fd1c768ba7d8855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:58:20 +0200 Subject: [PATCH 06/25] Added missing license files --- .../cell-range-selector-executor/test-A1:C16.xlsx.license | 3 +++ .../cell-range-selector-executor/test-B1:C2.xlsx.license | 3 +++ .../cell-range-selector-executor/test-empty.xlsx.license | 3 +++ .../test/assets/cell-writer-executor/test-A1:C16.xlsx.license | 3 +++ .../test/assets/cell-writer-executor/test-empty.xlsx.license | 3 +++ 5 files changed, 15 insertions(+) create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-B1:C2.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-empty.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-empty.xlsx.license diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx.license b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-A1:C16.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-B1:C2.xlsx.license b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-B1:C2.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-B1:C2.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-empty.xlsx.license b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-empty.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/test-empty.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx.license b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-A1:C16.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-empty.xlsx.license b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-empty.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/test-empty.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only From 1971864b12bee429bb67e77d6f236b7ac4f3b44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:58:41 +0200 Subject: [PATCH 07/25] Added column-deleter tests --- .../src/lib/column-deleter-executor.spec.ts | 168 ++++++++++++++++++ .../column-deleter-executor/test-A1:B2.xlsx | Bin 0 -> 5963 bytes .../test-A1:B2.xlsx.license | 3 + .../column-deleter-executor/test-A1:C16.xlsx | Bin 0 -> 5904 bytes .../test-A1:C16.xlsx.license | 3 + .../valid-duplicate-column.jv | 18 ++ .../valid-multiple-column-deleter.jv | 18 ++ .../valid-single-column-deleter.jv | 18 ++ 8 files changed, 228 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:B2.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:B2.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:C16.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:C16.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-duplicate-column.jv create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv create mode 100644 libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv diff --git a/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts new file mode 100644 index 000000000..e9e6ba32e --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts @@ -0,0 +1,168 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { ColumnDeleterExecutor } from './column-deleter-executor'; + +describe('Validation of ColumnDeleterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/column-deleter-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/column-deleter-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Sheet, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new ColumnDeleterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid single column deleter', async () => { + const text = readJvTestAsset('valid-single-column-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(2); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['Test', 'true']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['Test', 'true'], + ['Test', 'false'], + ['Test', 'true'], + ]), + ); + } + }); + + it('should diagnose no error on valid multiple column deleter', async () => { + const text = readJvTestAsset('valid-multiple-column-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(1); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['Test']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([['Test'], ['Test'], ['Test']]), + ); + } + }); + + it('should diagnose error on deleting non existing column', async () => { + const text = readJvTestAsset('valid-multiple-column-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:B2.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified column C does not exist in the sheet', + ); + } + }); + + it('should diagnose only one column deletion on duplicate columns', async () => { + const text = readJvTestAsset('valid-duplicate-column.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(2); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['Test', 'true']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['Test', 'true'], + ['Test', 'false'], + ['Test', 'true'], + ]), + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:B2.xlsx b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/test-A1:B2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..3465ea34d220774609e8f2f20a78490c8151e05b GIT binary patch literal 5963 zcmaJ_Wmr^e*QUE00qK?wiJ?Pk5C@QwW@s1~K#*>vC3O&xMnJj+B&9nAlvKJwLWy_A z^Ik_@zwewi*X)@ed#(NK`?=S>p0%{pQPIedu&}U@<`nhxkZu_+{J$v_?C8eFi@261 zwrh6s@Z{NJ@eiTh$ro>K|}zk-wnf zd~boDP2D6?*B}z5h0W5huxsGj^%z2$vDgC;M1cz$|4{8@a9OTD&&U0R8qUTs zP<;$}-EzkYNlG>XYOL!icy0B3E!1EqhQ!t8an7dzwB}HtlY@w}Dm|^Yw9twkQxfCT zUNwze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K+efEaONEZY*X_2H({`-Z}<~Qec}E&h)>pX0ednH>5v0GvX;C zw~1dB`d;u7Y8!w3E0AC2l!HGM4nyOwz9hQ^&F`=8ryP3 zbM+|kDSA|fQhzmdaXmVWZ5|>t*NeAiA8Ef7>4=*j45H;lOpkCSn!y8@^J-a-&&`?5 z2{S7JTc9>isfJf%aZ2t>6rDfOWqB>!plu&_(MTE08lAE&e1@o!)9DJXn5_=~qV^sX7i~6hIj?VU^%AVc}Rdhl$)+O|FqIguf*7 zeEnJ&ncg+%2{J;uKJU^HDPPQu;RM!_sgUCE)qGdL?FfRovAB?HC~$qx_shn@Cj8-> zqVP`jx64jA`fV;^1xUdkT^eqIVBF}-wF%6GP?$s2ro{33S<)S3+T>6y@>b8 z2Nn(&=J)RL;r8u*_xSJfU=#VL;=^^+{c`TN5Z=A&f3NEPwDWK|algF!En;`EcxUI~ zD(g?>hg0W0%YKW?U3s}v{&So0r-6qZ{QYqHTNaT1sXqT2RsU3dSj6sI{NFN;`maC! z9}WMXRvs3H`-1mdfOly8xAOO=g@>u@zJUCe>pKhoQBM9;e;C5|`R%u)-&y;Y`u}IU iKeZoH>)#zPf&E{DURe(D4p TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv new file mode 100644 index 000000000..c129b7639 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype ColumnDeleter { + delete: [column A, column C]; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv new file mode 100644 index 000000000..0f6f33474 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype ColumnDeleter { + delete: [column A]; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From 1e53ac3fc3df61b8d9e2fded1b80550d426ea80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 10:58:54 +0200 Subject: [PATCH 08/25] Added row-deleter tests --- .../exec/src/lib/row-deleter-executor.spec.ts | 163 ++++++++++++++++++ .../row-deleter-executor/test-A1:B2.xlsx | Bin 0 -> 5963 bytes .../test-A1:B2.xlsx.license | 3 + .../row-deleter-executor/test-A1:C16.xlsx | Bin 0 -> 5904 bytes .../test-A1:C16.xlsx.license | 3 + .../valid-duplicate-row.jv | 18 ++ .../valid-multiple-row-deleter.jv | 18 ++ .../valid-single-row-deleter.jv | 18 ++ 8 files changed, 223 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:B2.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:B2.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:C16.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:C16.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-duplicate-row.jv create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv create mode 100644 libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv diff --git a/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts new file mode 100644 index 000000000..c91382169 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts @@ -0,0 +1,163 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { RowDeleterExecutor } from './row-deleter-executor'; + +describe('Validation of RowDeleterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/row-deleter-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/row-deleter-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Sheet, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new RowDeleterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid single row deleter', async () => { + const text = readJvTestAsset('valid-single-row-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(15); + expect(result.right.getHeaderRow()).toEqual(['1', 'Test', 'false']); + expect(result.right.getData()).not.toEqual( + expect.arrayContaining([['0', 'Test', 'true']]), + ); + } + }); + + it('should diagnose no error on valid multiple row deleter', async () => { + const text = readJvTestAsset('valid-multiple-row-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(14); + expect(result.right.getHeaderRow()).toEqual(['1', 'Test', 'false']); + expect(result.right.getData()).not.toEqual( + expect.arrayContaining([ + ['0', 'Test', 'true'], + ['4', 'Test', 'true'], + ]), + ); + } + }); + + it('should diagnose error on deleting non existing row', async () => { + const text = readJvTestAsset('valid-multiple-row-deleter.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:B2.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified row 5 does not exist in the sheet', + ); + } + }); + + it('should diagnose only one row deletion on duplicate rows', async () => { + const text = readJvTestAsset('valid-duplicate-row.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(15); + expect(result.right.getHeaderRow()).toEqual(['1', 'Test', 'false']); + expect(result.right.getData()).not.toEqual( + expect.arrayContaining([['0', 'Test', 'true']]), + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:B2.xlsx b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/test-A1:B2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..3465ea34d220774609e8f2f20a78490c8151e05b GIT binary patch literal 5963 zcmaJ_Wmr^e*QUE00qK?wiJ?Pk5C@QwW@s1~K#*>vC3O&xMnJj+B&9nAlvKJwLWy_A z^Ik_@zwewi*X)@ed#(NK`?=S>p0%{pQPIedu&}U@<`nhxkZu_+{J$v_?C8eFi@261 zwrh6s@Z{NJ@eiTh$ro>K|}zk-wnf zd~boDP2D6?*B}z5h0W5huxsGj^%z2$vDgC;M1cz$|4{8@a9OTD&&U0R8qUTs zP<;$}-EzkYNlG>XYOL!icy0B3E!1EqhQ!t8an7dzwB}HtlY@w}Dm|^Yw9twkQxfCT zUNwze-$Jow5`1tt&a(xuU*o{yelh_y9={5Z_$A}oUN6N&eH`Oe^1$Y+SETP7*Pt#I zCm2J`B%%B^?mj?fKNXF=H{^6erfSiKnU@1=q+05jSYc_xX?t)GhEb4^wEhvMJMcTa z9Qpo2$`b;0uz)}uc)gq)|3VEUXWz+B)Vxk^v0uBB7Ye$!PJ+`|u!$PlT&Ll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qB>!plu&_(MTE08lAE&e1@o!)9DJXn5_=~qV^sX7i~6hIj?VU^%AVc}Rdhl$)+O|FqIguf*7 zeEnJ&ncg+%2{J;uKJU^HDPPQu;RM!_sgUCE)qGdL?FfRovAB?HC~$qx_shn@Cj8-> zqVP`jx64jA`fV;^1xUdkT^eqIVBF}-wF%6GP?$s2ro{33S<)S3+T>6y@>b8 z2Nn(&=J)RL;r8u*_xSJfU=#VL;=^^+{c`TN5Z=A&f3NEPwDWK|algF!En;`EcxUI~ zD(g?>hg0W0%YKW?U3s}v{&So0r-6qZ{QYqHTNaT1sXqT2RsU3dSj6sI{NFN;`maC! z9}WMXRvs3H`-1mdfOly8xAOO=g@>u@zJUCe>pKhoQBM9;e;C5|`R%u)-&y;Y`u}IU iKeZoH>)#zPf&E{DURe(D4p TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv new file mode 100644 index 000000000..9276db92f --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype RowDeleter { + delete: [row 1, row 5]; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv new file mode 100644 index 000000000..df7bad681 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype RowDeleter { + delete: [row 1]; + } + + block TestLoader oftype TestFileLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From 7d75217973e3e358cf22f0c4088eb006fe82f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 11:41:14 +0200 Subject: [PATCH 09/25] - Moved file-util into @jvalue/jayvee-execution due to required usage in tabular extension tests - Extracted splitLines into string-util in @jvalue/jayvee-execution for the same reason --- .../src => execution/src/lib/util}/file-util.ts | 3 ++- libs/execution/src/lib/util/index.ts | 2 ++ libs/execution/src/lib/util/string-util.ts | 14 ++++++++++++++ .../std/exec/src/archive-interpreter-executor.ts | 7 ++----- .../std/exec/src/http-extractor-executor.ts | 8 +++----- .../std/exec/src/text-file-interpreter-executor.ts | 12 +----------- 6 files changed, 24 insertions(+), 22 deletions(-) rename libs/{extensions/std/exec/src => execution/src/lib/util}/file-util.ts (95%) create mode 100644 libs/execution/src/lib/util/string-util.ts diff --git a/libs/extensions/std/exec/src/file-util.ts b/libs/execution/src/lib/util/file-util.ts similarity index 95% rename from libs/extensions/std/exec/src/file-util.ts rename to libs/execution/src/lib/util/file-util.ts index d82ef000c..23e449997 100644 --- a/libs/extensions/std/exec/src/file-util.ts +++ b/libs/execution/src/lib/util/file-util.ts @@ -2,9 +2,10 @@ // // SPDX-License-Identifier: AGPL-3.0-only -import { FileExtension, MimeType } from '@jvalue/jayvee-execution'; import * as mime from 'mime-types'; +import { FileExtension, MimeType } from '../types'; + export function inferMimeTypeFromContentTypeString( fileExtension: string | undefined, ): MimeType | undefined { diff --git a/libs/execution/src/lib/util/index.ts b/libs/execution/src/lib/util/index.ts index 28697b9ea..9e67d5d9d 100644 --- a/libs/execution/src/lib/util/index.ts +++ b/libs/execution/src/lib/util/index.ts @@ -3,3 +3,5 @@ // SPDX-License-Identifier: AGPL-3.0-only export * from './implements-static-decorator'; +export * from './file-util'; +export * from './string-util'; diff --git a/libs/execution/src/lib/util/string-util.ts b/libs/execution/src/lib/util/string-util.ts new file mode 100644 index 000000000..55b7d78b0 --- /dev/null +++ b/libs/execution/src/lib/util/string-util.ts @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +export function splitLines(textContent: string, lineBreak: RegExp): string[] { + const lines = textContent.split(lineBreak); + + // There may be an additional empty line due to the previous splitting + if (lines[lines.length - 1] === '') { + lines.splice(lines.length - 1, 1); + } + + return lines; +} diff --git a/libs/extensions/std/exec/src/archive-interpreter-executor.ts b/libs/extensions/std/exec/src/archive-interpreter-executor.ts index bf78fe65d..98569e8c8 100644 --- a/libs/extensions/std/exec/src/archive-interpreter-executor.ts +++ b/libs/extensions/std/exec/src/archive-interpreter-executor.ts @@ -18,15 +18,12 @@ import { MimeType, err, implementsStatic, + inferFileExtensionFromFileExtensionString, + inferMimeTypeFromContentTypeString, } from '@jvalue/jayvee-execution'; import { IOType, PrimitiveValuetypes } from '@jvalue/jayvee-language-server'; import * as JSZip from 'jszip'; -import { - inferFileExtensionFromFileExtensionString, - inferMimeTypeFromContentTypeString, -} from './file-util'; - @implementsStatic() export class ArchiveInterpreterExecutor extends AbstractBlockExecutor< IOType.FILE, diff --git a/libs/extensions/std/exec/src/http-extractor-executor.ts b/libs/extensions/std/exec/src/http-extractor-executor.ts index 03534cfcb..2017c7887 100644 --- a/libs/extensions/std/exec/src/http-extractor-executor.ts +++ b/libs/extensions/std/exec/src/http-extractor-executor.ts @@ -16,16 +16,14 @@ import { MimeType, None, implementsStatic, + inferFileExtensionFromContentTypeString, + inferFileExtensionFromFileExtensionString, + inferMimeTypeFromContentTypeString, } from '@jvalue/jayvee-execution'; import { IOType, PrimitiveValuetypes } from '@jvalue/jayvee-language-server'; import { http, https } from 'follow-redirects'; import { AstNode } from 'langium'; -import { - inferFileExtensionFromContentTypeString, - inferFileExtensionFromFileExtensionString, - inferMimeTypeFromContentTypeString, -} from './file-util'; import { createBackoffStrategy, isBackoffStrategyHandle, diff --git a/libs/extensions/std/exec/src/text-file-interpreter-executor.ts b/libs/extensions/std/exec/src/text-file-interpreter-executor.ts index 3efe2e9c1..e3fb113e2 100644 --- a/libs/extensions/std/exec/src/text-file-interpreter-executor.ts +++ b/libs/extensions/std/exec/src/text-file-interpreter-executor.ts @@ -12,6 +12,7 @@ import { ExecutionContext, TextFile, implementsStatic, + splitLines, } from '@jvalue/jayvee-execution'; import { IOType, PrimitiveValuetypes } from '@jvalue/jayvee-language-server'; @@ -57,14 +58,3 @@ export class TextFileInterpreterExecutor extends AbstractBlockExecutor< return R.ok(new TextFile(file.name, file.extension, file.mimeType, lines)); } } - -function splitLines(textContent: string, lineBreak: RegExp): string[] { - const lines = textContent.split(lineBreak); - - // There may be an additional empty line due to the previous splitting - if (lines[lines.length - 1] === '') { - lines.splice(lines.length - 1, 1); - } - - return lines; -} From 40b708a9d5dd67a01270f5e759672504445ffe71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 11:44:03 +0200 Subject: [PATCH 10/25] - Added new file-util in @jvalue/jayvee-execution/test containing the functions to create BinaryFile and TextFile from local files - Renamed utils.ts into test-infrastructure-util.ts and moved into utils subdirectory --- libs/execution/test/utils/file-util.ts | 44 +++++++++++++++++++ libs/execution/test/utils/index.ts | 6 +++ .../test-infrastructure-util.ts} | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 libs/execution/test/utils/file-util.ts create mode 100644 libs/execution/test/utils/index.ts rename libs/execution/test/{utils.ts => utils/test-infrastructure-util.ts} (98%) diff --git a/libs/execution/test/utils/file-util.ts b/libs/execution/test/utils/file-util.ts new file mode 100644 index 000000000..35ace2292 --- /dev/null +++ b/libs/execution/test/utils/file-util.ts @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import { readFileSync } from 'fs'; +import * as path from 'path'; + +import { + BinaryFile, + FileExtension, + MimeType, + TextFile, + inferFileExtensionFromFileExtensionString, + inferMimeTypeFromContentTypeString, + splitLines, +} from '../../src'; + +export function createBinaryFileFromLocalFile(fileName: string): BinaryFile { + const extName = path.extname(fileName); + const mimeType = + inferMimeTypeFromContentTypeString(extName) || + MimeType.APPLICATION_OCTET_STREAM; + const fileExtension = + inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; + const file = readFileSync(path.resolve(__dirname, fileName)); + return new BinaryFile(path.basename(fileName), fileExtension, mimeType, file); +} + +export function createTextFileFromLocalFile(fileName: string): TextFile { + const extName = path.extname(fileName); + const mimeType = + inferMimeTypeFromContentTypeString(extName) || + MimeType.APPLICATION_OCTET_STREAM; + const fileExtension = + inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; + const fileContent = readFileSync(path.resolve(__dirname, fileName), 'utf-8'); + + return new TextFile( + path.basename(fileName), + fileExtension, + mimeType, + splitLines(fileContent, /\r?\n/), + ); +} diff --git a/libs/execution/test/utils/index.ts b/libs/execution/test/utils/index.ts new file mode 100644 index 000000000..144030b35 --- /dev/null +++ b/libs/execution/test/utils/index.ts @@ -0,0 +1,6 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +export * from './test-infrastructure-util'; +export * from './file-util'; diff --git a/libs/execution/test/utils.ts b/libs/execution/test/utils/test-infrastructure-util.ts similarity index 98% rename from libs/execution/test/utils.ts rename to libs/execution/test/utils/test-infrastructure-util.ts index 639c4239e..ff641eaf1 100644 --- a/libs/execution/test/utils.ts +++ b/libs/execution/test/utils/test-infrastructure-util.ts @@ -17,7 +17,7 @@ import { StackNode, blockExecutorRegistry, constraintExecutorRegistry, -} from '../src'; +} from '../../src'; export function clearBlockExecutorRegistry() { blockExecutorRegistry.clear(); From c8f2695ce50b1b43eab0d4e340473cf07dd7e653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 12:16:23 +0200 Subject: [PATCH 11/25] - Moved jsdom-environment-fix.ts from ./src into ./test - Added same fix for setImmediate which is used inside 'fast-csv' (used inside csv-interpreter) --- libs/extensions/tabular/exec/jest.config.ts | 2 +- .../tabular/exec/src/jsdom-environment-fix.ts | 14 -------------- .../exec/test/jsdom-environment-fix.ts | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 15 deletions(-) delete mode 100644 libs/extensions/tabular/exec/src/jsdom-environment-fix.ts create mode 100644 libs/extensions/tabular/exec/test/jsdom-environment-fix.ts diff --git a/libs/extensions/tabular/exec/jest.config.ts b/libs/extensions/tabular/exec/jest.config.ts index 9844a26bb..a5a6a3c7d 100644 --- a/libs/extensions/tabular/exec/jest.config.ts +++ b/libs/extensions/tabular/exec/jest.config.ts @@ -5,7 +5,7 @@ export default { displayName: 'extensions-tabular-exec', preset: '../../../../jest.preset.js', - testEnvironment: './src/jsdom-environment-fix.ts', + testEnvironment: './test/jsdom-environment-fix.ts', globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json', diff --git a/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts b/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts deleted file mode 100644 index c18ba7718..000000000 --- a/libs/extensions/tabular/exec/src/jsdom-environment-fix.ts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg -// -// SPDX-License-Identifier: AGPL-3.0-only - -import JSDOMEnvironment from 'jest-environment-jsdom'; - -// https://github.com/jsdom/jsdom/issues/3363 -export default class FixJSDOMEnvironment extends JSDOMEnvironment { - constructor(...args: ConstructorParameters) { - super(...args); - - this.global.structuredClone = structuredClone; - } -} diff --git a/libs/extensions/tabular/exec/test/jsdom-environment-fix.ts b/libs/extensions/tabular/exec/test/jsdom-environment-fix.ts new file mode 100644 index 000000000..d5af83010 --- /dev/null +++ b/libs/extensions/tabular/exec/test/jsdom-environment-fix.ts @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import JSDOMEnvironment from 'jest-environment-jsdom'; + +// @nrwl/jest/preset loads in jsdom environment which does not support a few node.js functions. +// This class adds these node.js functions. +export default class JSDOMEnvironmentFix extends JSDOMEnvironment { + constructor(...args: ConstructorParameters) { + super(...args); + + // https://github.com/jsdom/jsdom/issues/3363 + this.global.structuredClone = structuredClone; + // https://github.com/jestjs/jest/issues/11204 + // https://github.com/jestjs/jest/issues/12622 + this.global.setImmediate = setImmediate; + } +} From 0550e12f3d74b47857d074865360f092b0dd6630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 12:29:42 +0200 Subject: [PATCH 12/25] Fixed extractor and loader types --- .../test/assets/cell-range-selector-executor/valid-A1:A4.jv | 4 ++-- .../test/assets/cell-range-selector-executor/valid-A1:C*.jv | 4 ++-- .../test/assets/cell-range-selector-executor/valid-A1:E4.jv | 4 ++-- .../assets/cell-writer-executor/valid-cell-range-writer.jv | 4 ++-- .../assets/cell-writer-executor/valid-single-cell-writer.jv | 4 ++-- .../assets/column-deleter-executor/valid-duplicate-column.jv | 4 ++-- .../column-deleter-executor/valid-multiple-column-deleter.jv | 4 ++-- .../column-deleter-executor/valid-single-column-deleter.jv | 4 ++-- .../test/assets/row-deleter-executor/valid-duplicate-row.jv | 4 ++-- .../assets/row-deleter-executor/valid-multiple-row-deleter.jv | 4 ++-- .../assets/row-deleter-executor/valid-single-row-deleter.jv | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv index 666e6e2ef..4fa94a1c9 100644 --- a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:A4.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype CellRangeSelector { select: range A1:A4; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv index 9f6c914be..0ed56a14a 100644 --- a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:C*.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype CellRangeSelector { select: range A1:C*; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv index 605210d2d..e004eb928 100644 --- a/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv +++ b/libs/extensions/tabular/exec/test/assets/cell-range-selector-executor/valid-A1:E4.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype CellRangeSelector { select: range A1:E4; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv index 4ce5bece6..327d9dbaa 100644 --- a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-cell-range-writer.jv @@ -4,7 +4,7 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype CellWriter { @@ -12,7 +12,7 @@ pipeline TestPipeline { at: range A1:C1; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv index a7390b52e..844a8fd88 100644 --- a/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv +++ b/libs/extensions/tabular/exec/test/assets/cell-writer-executor/valid-single-cell-writer.jv @@ -4,7 +4,7 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype CellWriter { @@ -12,7 +12,7 @@ pipeline TestPipeline { at: cell A1; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-duplicate-column.jv b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-duplicate-column.jv index 270394398..b3b6a6ae4 100644 --- a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-duplicate-column.jv +++ b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-duplicate-column.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype ColumnDeleter { delete: [column A, column A]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv index c129b7639..6a2aa56d2 100644 --- a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv +++ b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-multiple-column-deleter.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype ColumnDeleter { delete: [column A, column C]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv index 0f6f33474..ad5f6733b 100644 --- a/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv +++ b/libs/extensions/tabular/exec/test/assets/column-deleter-executor/valid-single-column-deleter.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype ColumnDeleter { delete: [column A]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-duplicate-row.jv b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-duplicate-row.jv index 5d2e70f93..cbb08f0f9 100644 --- a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-duplicate-row.jv +++ b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-duplicate-row.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype RowDeleter { delete: [row 1, row 1]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv index 9276db92f..d1384e505 100644 --- a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv +++ b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-multiple-row-deleter.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype RowDeleter { delete: [row 1, row 5]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; diff --git a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv index df7bad681..cbb6610ff 100644 --- a/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv +++ b/libs/extensions/tabular/exec/test/assets/row-deleter-executor/valid-single-row-deleter.jv @@ -4,14 +4,14 @@ pipeline TestPipeline { - block TestExtractor oftype TestFileExtractor { + block TestExtractor oftype TestSheetExtractor { } block TestBlock oftype RowDeleter { delete: [row 1]; } - block TestLoader oftype TestFileLoader { + block TestLoader oftype TestSheetLoader { } TestExtractor -> TestBlock -> TestLoader; From a75aeffd488f5a55b78ecc2d81f8f9a1842ae175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 12:30:16 +0200 Subject: [PATCH 13/25] Added test for csv-interpreter --- .../src/lib/csv-interpreter-executor.spec.ts | 99 +++++++++++++++++++ .../valid-csv-interpreter.jv | 17 ++++ .../csv-interpreter-executor/valid-csv.csv | 2 + 3 files changed, 118 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv-interpreter.jv create mode 100644 libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv diff --git a/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts new file mode 100644 index 000000000..8405f395f --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { + createTextFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { CSVInterpreterExecutor } from './csv-interpreter-executor'; + +describe('Validation of CSVInterpreterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/csv-interpreter-executor/', + ); + + function readTestFile(fileName: string): R.TextFile { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/csv-interpreter-executor/', + fileName, + ); + return createTextFileFromLocalFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.TextFile, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new CSVInterpreterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid csv file', async () => { + const text = readJvTestAsset('valid-csv-interpreter.jv'); + + const testCsv = readTestFile('valid-csv.csv'); + const result = await parseAndExecuteExecutor(text, testCsv); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(2); + expect(result.right.getNumberOfRows()).toEqual(2); + expect(result.right.getData()).toEqual([ + ['Test', 'true'], + ['Test', 'false'], + ]); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv-interpreter.jv b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv-interpreter.jv new file mode 100644 index 000000000..856c67eb0 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv-interpreter.jv @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestTextFileExtractor { + } + + block TestBlock oftype CSVInterpreter { + } + + block TestLoader oftype TestSheetLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv new file mode 100644 index 000000000..086eb44a1 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv @@ -0,0 +1,2 @@ +Test,true +Test,false From ea613de4546456c0b2a0723e456be45e6cf667a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 12:39:17 +0200 Subject: [PATCH 14/25] Added tests for sheet-picker-executor --- .../src/lib/sheet-picker-executor.spec.ts | 116 ++++++++++++++++++ .../sheet-picker-executor/test-A1:C16.xlsx | Bin 0 -> 5904 bytes .../valid-custom-sheet-name.jv | 18 +++ .../valid-sheet-picker.jv | 18 +++ 4 files changed, 152 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/sheet-picker-executor/valid-custom-sheet-name.jv create mode 100644 libs/extensions/tabular/exec/test/assets/sheet-picker-executor/valid-sheet-picker.jv diff --git a/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts new file mode 100644 index 000000000..9dfba7ea0 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts @@ -0,0 +1,116 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { SheetPickerExecutor } from './sheet-picker-executor'; + +describe('Validation of SheetPickerExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/sheet-picker-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/sheet-picker-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Workbook, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new SheetPickerExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid workbook', async () => { + const text = readJvTestAsset('valid-sheet-picker.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor(text, testWorkbook); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.SHEET); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getHeaderRow()).toEqual(['0', 'Test', 'true']); + expect(result.right.getData()).toEqual( + expect.arrayContaining([ + ['0', 'Test', 'true'], + ['1', 'Test', 'false'], + ['15', 'Test', 'true'], + ]), + ); + } + }); + + it('should diagnose error on sheet not found', async () => { + const text = readJvTestAsset('valid-custom-sheet-name.jv'); + + const testWorkbook = await readTestWorkbook('test-A1:C16.xlsx'); + const result = await parseAndExecuteExecutor(text, testWorkbook); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'Workbook does not contain a sheet named MyCustomSheet', + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx b/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..0544fa2814c07cf9c2736a400489785567ac1b4d GIT binary patch literal 5904 zcmaJ_WmJ^y)}~`dx{>ZqDQN_yK|-WMha4Cfy1To(q?GOs2?6OwK)OSalo0s9_ghDf z=N$K}_00UZ_kQNS_O(-44jus)1_cELCV^K&1LlDM?|$n;L10^Uw)VU$D_al zcR-HoYPCP-^EAD_tU9hnAG@=#vr^xFKrC+<0=MW5oW@q)$}+`j5Q7o${2Q0U1{_NAyszj z9W2+FxyIJ$Z9({1U_L)F;b?=IV1TVoO;!HX~?qCE8ADNa0TBe{$ILc2^^0Z*EQW{2Ab>XhVW%Bo^NP7mS| zVrLuRH$i1NWE6`w2ZY7DTT8&fz$pJuT!`;ZIDy&!fyNO6wJ?G}EZCeZ!T-RdB7O%G zX7eVV(Lv2#uAd6aCN`iUe;eMfxmF%5W6EcFbXBNeN`jJ&oY^&CZW3VFKWVe|iT?Rc zv#Ro20TjFL>2wP`x4nf7Jp=W@KGw68ae_)+if9KC#`1w>by+TaWQAmmt+Cugn~^jF zFlfZMOgrvaNWYJN%4_GjD%c#+MwNiVp}^~Q^h{x#NXONdaO98__}PpgHYS0N$Q;L`mIDpKM*7;=ZaH6msf`I! zZ};r&*(&gO1->R14V~iCy|&1N)zVIfFO<>JA(4@5$447#atA2gfD$A82>1=}K6}au zHseLI@zFGA{064_34oCUQoq%!gM<>^EBW1)7Z-iq#S&orR>(2H+^VM$Rw`O0HHA9a zcyq2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T1sXqT2RsU3dSj6sI{NFN;`maC! z9}WMXRvs3H`-1mdfOly8xAOO=g@>u@zJUCe>pKhoQBM9;e;C5|`R%u)-&y;Y`u}IU iKeZoH>)#zPf&E{DURe(D4p TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/valid-sheet-picker.jv b/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/valid-sheet-picker.jv new file mode 100644 index 000000000..40654c112 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/valid-sheet-picker.jv @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestWorkbookExtractor { + } + + block TestBlock oftype SheetPicker { + sheetName: "Sheet1"; + } + + block TestLoader oftype TestSheetLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From affff535f8fc63706cccf197f82f7e0834907d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 23 Oct 2023 12:47:50 +0200 Subject: [PATCH 15/25] Added missing license file --- .../test/assets/sheet-picker-executor/test-A1:C16.xlsx.license | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx.license diff --git a/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx.license b/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/sheet-picker-executor/test-A1:C16.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only From 6a59114a7756aea0fe9d5e41c7bb9ce436259110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 09:01:09 +0100 Subject: [PATCH 16/25] Added tests for TableInterpreterExecutor --- .../lib/table-interpreter-executor.spec.ts | 265 ++++++++++++++++++ .../test-empty.xlsx | Bin 0 -> 5410 bytes .../test-empty.xlsx.license | 3 + .../test-with-header.xlsx | Bin 0 -> 6275 bytes .../test-with-header.xlsx.license | 3 + .../test-without-header.xlsx | Bin 0 -> 6234 bytes .../test-without-header.xlsx.license | 3 + .../valid-with-capitalized-header.jv | 23 ++ .../valid-with-header.jv | 23 ++ .../valid-without-header.jv | 23 ++ .../valid-wrong-valuetype-with-header.jv | 23 ++ .../valid-wrong-valuetype-without-header.jv | 23 ++ 12 files changed, 389 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-with-header.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-with-header.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-without-header.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-without-header.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-capitalized-header.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-header.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-without-header.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-with-header.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-without-header.jv diff --git a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts new file mode 100644 index 000000000..4f543a5d0 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts @@ -0,0 +1,265 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { createWorkbookFromLocalExcelFile } from '../../test/util'; + +import { TableInterpreterExecutor } from './table-interpreter-executor'; + +describe('Validation of TableInterpreterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/table-interpreter-executor/', + ); + + async function readTestWorkbook(fileName: string): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/table-interpreter-executor/', + fileName, + ); + return await createWorkbookFromLocalExcelFile(absoluteFileName); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Sheet, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new TableInterpreterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + describe('validation of sheet with header', () => { + it('should diagnose no error on valid sheet', async () => { + const text = readJvTestAsset('valid-with-header.jv'); + + const testWorkbook = await readTestWorkbook('test-with-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 1, 2, 15]) as number[], + }), + ); + expect(result.right.getColumn('name')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining(['Test']) as string[], + }), + ); + expect(result.right.getColumn('flag')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([true, false]) as boolean[], + }), + ); + } + }); + + it('should diagnose empty table on wrong header case', async () => { + const text = readJvTestAsset('valid-with-capitalized-header.jv'); + + const testWorkbook = await readTestWorkbook('test-with-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(0); + expect(result.right.getNumberOfRows()).toEqual(16); + } + }); + + it('should diagnose error on empty sheet', async () => { + const text = readJvTestAsset('valid-with-header.jv'); + + const testWorkbook = await readTestWorkbook('test-empty.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The input sheet is empty and thus has no header', + ); + } + }); + + it('should diagnose skipping row on wrong cell valuetype', async () => { + const text = readJvTestAsset('valid-wrong-valuetype-with-header.jv'); + + const testWorkbook = await readTestWorkbook('test-with-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(0); + } + }); + }); + + describe('validation of sheet without header', () => { + it('should diagnose no error on valid sheet', async () => { + const text = readJvTestAsset('valid-without-header.jv'); + + const testWorkbook = await readTestWorkbook('test-without-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 1, 2, 15]) as number[], + }), + ); + expect(result.right.getColumn('name')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining(['Test']) as string[], + }), + ); + expect(result.right.getColumn('flag')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([true, false]) as boolean[], + }), + ); + } + }); + + it('should diagnose no error on valid sheet with header', async () => { + const text = readJvTestAsset('valid-without-header.jv'); + + const testWorkbook = await readTestWorkbook('test-with-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 1, 2, 15]) as number[], + }), + ); + expect(result.right.getColumn('name')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining(['Test']) as string[], + }), + ); + expect(result.right.getColumn('flag')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([true, false]) as boolean[], + }), + ); + } + }); + + it('should diagnose error on empty sheet', async () => { + const text = readJvTestAsset('valid-without-header.jv'); + + const testWorkbook = await readTestWorkbook('test-empty.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'There are 3 column definitions but the input sheet only has 0 columns', + ); + } + }); + + it('should diagnose skipping row on wrong cell valuetype', async () => { + const text = readJvTestAsset('valid-wrong-valuetype-without-header.jv'); + + const testWorkbook = await readTestWorkbook('test-without-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(0); + } + }); + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..af7b184be1b847220d6c83fb152e1f4618a6c4d3 GIT binary patch literal 5410 zcmaJ_2UJsAvnE0Ssi6r0kq$y=Qj}gqO6VYwD!m612wi#r3%xh#Eg~YKND+{(bRje; z(yNyu7OKDt-v3?reeXJF`DXUa=xX2-(Bcsj6XWqq8XDrA6H?r73zVIU zhmhduy*#l+yG@wv{+53v->)>*dYdQG)@HnA(soCv1Zj|$tvzV6(jp(cxY*%s>_ z6nt!5Jgte~pBCoUFn4wY$Tef{(!j4dGg@aB&2bWC}2uu$mTC8r$+_=cS>VShl0&p0)IJ znm2XJC^zfxgnbRv;ld7{{#qP?YMPt5bj+d_>QN>+KYNyGbTx>GBQnJ@H*p~JU%p$e4-y5pMk3*Y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ik}gy$_0^4EKhnQ;Igb^)UJS>cixTIb@A{j=n0k~V@I%1HejcYU$g{??53c|eks z!HC{?1kFBsfaL!6XYnHq3fq~jy=f$yziVNT!zBIbxiB}17m|kC^)~MF@69Oa{Cios zx&3;ncrBe@jr-3?zKPdRX+`ku%!}a?T4<$=S{R#qOsqy@WaD!%HCP~_vy4dUMwosdZ%iRIXm2lHoG^AA1hAV_N*_>VJ&31mXQy#-85HDd z;^d5EX1L;xn4AKe3Ck>rxIAJa%oBcamoirFaGFKebF%{DU* zyRQ-!^TKceG&o-#ZV!I&Uf|}%sU-QEChH%Gs(e(}&m{yZ?ZYI&JtZ|f23arC2I$r5V5j;M* z_><1>vKEX^D9@lnKaaC=0uSPfKRXa$MAK3$)9mAGm4B#B=ud1zfmc3RWvRn_gY2kH zk0`X*3Y@cB|0r(%Fd)y{KDm02fI(uq`H=40XQKsH;n*#mW2l)4rhRtcQ@YJuCxa&8 zNkOviv2C0_W6r`)@>35PicuC@;k?rbJoOOZ0xjOzIO_Za=5!qO-*Rp^^}FKvDaGl4 z=1h2SOa1$}=65^iJJ-{h#+k_A@(a$+`3cAG%I8~>Q-+<18^JH--&@_^4VeGM!1Ab`qLI3~& literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx.license b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-empty.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-with-header.xlsx b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-with-header.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..9417e87a43e2556b5597c0f2b2e20557b922f2dd GIT binary patch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5V24(UGijTEn+aZoi_OpmKNv;pYVil9BTWx}M}qsx^1cKV(5=eI^ii z>osn|fgjZgj1gdSlq#fg$p6?kPnIlYCB&iZs+;MqD~9fCN!?fkCP>3Zbtb~WN9_Jm zN89T+Pc+D_=e7=KU9b5$=LXtN(VwqtVGIzQjD6~D?EBx@M|pW&7H)387WEA3`YYFt zY4uxc)M6e)YG0|gpCq=ILE6>vX_$0iAY8nBXMsSmdD#~m<6~CG`CmF$7XjD!Y>i<{ zB(x916S_8y_9hw=v3uKE`f1Y8Zjg%IsEY6hRYv49npSqOlhdFaR}(vD^eqM!cbBPY zMiXJ#&o?%rt`cy~k3Jp@hFY8HlZEhxB(iA);pc$dJyp-b)p@iIJ~(^trMBAmW2_lIu4yz}k+Tnymg=N3KU*=!)1M4Coai;E7U=FB%a`$!={s4W^#lDCGC$%drk-A+paE1 zxC_!8=HmwUFg-`EG4WU0Dj%FgcNk;p;USdjlla)~Eaz3+W1h$MKc9U~+TUX2!B;01 z)aMhgTuk-r?`cI0b*hgIQojNl!L2c*YIuC(CPgor zN9!gVu%&8L1HsGfnuB9)D%AYxfW^ESq7U0}rJsax@(mgjcCYrI4#`X$QUwh8=%&l{i=(bp1Kw>YX$ zmq(nn3~YDCkF@K0)nrQzUiDZ-ar0~z##EO`R7g0lK#cmqnx{P9#CIgqgh=9W$B&e9 zINjTDmdbFxJ@BvMjwkjE-r9brbj7 zm`=K2v-B?LH6gEaAZY2=dEB0&hZ}+2E@gsqrUP+k02f2p%X7!`A?$zKrIGCKj+X~< z=VQqW!0(m*_XwBu z`Mg$M*j21}U1;)uD(CO+mu2w3A#BD*yKw(sN&h{-WkEPs%L_}Tz7*g;+WEWpWp4iW f-w$Aa{y!3;t$~l-82|u;eKlhl5{7Lu0f7GjVv1xZ literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-without-header.xlsx.license b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-without-header.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/test-without-header.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-capitalized-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-capitalized-header.jv new file mode 100644 index 000000000..3d9929495 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-capitalized-header.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: true; + columns: [ + "Index" oftype integer, + "Name" oftype text, + "Flag" oftype boolean + ]; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-header.jv new file mode 100644 index 000000000..cd368186b --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-header.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: true; + columns: [ + "index" oftype integer, + "name" oftype text, + "flag" oftype boolean + ]; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-without-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-without-header.jv new file mode 100644 index 000000000..6fa8f5c1d --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-without-header.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: false; + columns: [ + "index" oftype integer, + "name" oftype text, + "flag" oftype boolean + ]; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-with-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-with-header.jv new file mode 100644 index 000000000..f8ec03446 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-with-header.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: true; + columns: [ + "index" oftype integer, + "name" oftype text, + "flag" oftype integer + ]; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-without-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-without-header.jv new file mode 100644 index 000000000..ebc269171 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-valuetype-without-header.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: false; + columns: [ + "index" oftype integer, + "name" oftype text, + "flag" oftype integer + ]; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From 031a4d39289fcbebd4bcf6138d9eb3db4d244c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 09:01:51 +0100 Subject: [PATCH 17/25] Added missing license file --- .../test/assets/csv-interpreter-executor/valid-csv.csv.license | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv.license diff --git a/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv.license b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/csv-interpreter-executor/valid-csv.csv.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only From 11257eb9601921bd06c9e50d89c39fdc023ac817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 11:02:08 +0100 Subject: [PATCH 18/25] Added tests for TableTransformExecutor --- .../lib/table-transformer-executor.spec.ts | 222 ++++++++++++++++++ .../test-empty.xlsx | Bin 0 -> 5410 bytes .../test-empty.xlsx.license | 3 + .../test-excel.xlsx | Bin 0 -> 6132 bytes .../test-excel.xlsx.license | 3 + .../valid-column-overwrite.jv | 26 ++ .../valid-column-type-change.jv | 26 ++ .../valid-missing-input-column.jv | 27 +++ .../valid-transfomer.jv | 26 ++ .../valid-transform-type-missmatch.jv | 26 ++ .../test-multiple-sheet-all-cell-formats.xlsx | Bin 0 -> 7978 bytes libs/extensions/tabular/exec/test/util.ts | 87 ++++++- 12 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-excel.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-excel.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-column-overwrite.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-column-type-change.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-missing-input-column.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transfomer.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transform-type-missmatch.jv create mode 100644 libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx diff --git a/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts new file mode 100644 index 000000000..4ea0dce63 --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts @@ -0,0 +1,222 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + PrimitiveValuetypes, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { + ReducedColumnDefinitionEntry, + createTableFromLocalExcelFile, +} from '../../test/util'; + +import { TableTransformerExecutor } from './table-transformer-executor'; + +describe('Validation of TableTransformerExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/table-transformer-executor/', + ); + + async function readTestExcelAllColumns() { + return readTestTable('test-excel.xlsx', [ + { + columnName: 'index', + sheetColumnIndex: 0, + valuetype: PrimitiveValuetypes.Integer, + }, + { + columnName: 'name', + sheetColumnIndex: 1, + valuetype: PrimitiveValuetypes.Text, + }, + { + columnName: 'flag', + sheetColumnIndex: 2, + valuetype: PrimitiveValuetypes.Boolean, + }, + ]); + } + async function readTestTable( + fileName: string, + columnDefinitions: ReducedColumnDefinitionEntry[], + ): Promise { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/table-transformer-executor/', + fileName, + ); + return await createTableFromLocalExcelFile( + absoluteFileName, + columnDefinitions, + ); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.Table, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new TableTransformerExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on valid table transform', async () => { + const text = readJvTestAsset('valid-transfomer.jv'); + + const testTable = await readTestExcelAllColumns(); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(4); + expect(result.right.getNumberOfRows()).toEqual(6); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 1, 2, 5]) as number[], + }), + ); + expect(result.right.getColumn('index2')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 2, 4, 10]) as number[], + }), + ); + } + }); + + it('should diagnose no error on column overwrite', async () => { + const text = readJvTestAsset('valid-column-overwrite.jv'); + + const testTable = await readTestExcelAllColumns(); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(6); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: expect.arrayContaining([0, 2, 4, 10]) as number[], + }), + ); + } + }); + + it('should diagnose no error on column type change', async () => { + const text = readJvTestAsset('valid-column-type-change.jv'); + + const testTable = await readTestExcelAllColumns(); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(3); + expect(result.right.getNumberOfRows()).toEqual(6); + expect(result.right.getColumn('index')).toEqual( + expect.objectContaining({ + values: [false, true, true, true, true, true], + valuetype: PrimitiveValuetypes.Boolean, + }), + ); + } + }); + + it('should diagnose no error on empty table', async () => { + const text = readJvTestAsset('valid-transfomer.jv'); + + const testTable = await readTestTable('test-empty.xlsx', [ + { + columnName: 'index', + sheetColumnIndex: 0, + valuetype: PrimitiveValuetypes.Integer, + }, + ]); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(2); + expect(result.right.getNumberOfRows()).toEqual(0); + expect(result.right.getColumn('index')?.values).toHaveLength(0); + expect(result.right.getColumn('index2')?.values).toHaveLength(0); + } + }); + + it('should diagnose error on missing input column', async () => { + const text = readJvTestAsset('valid-missing-input-column.jv'); + + const testTable = await readTestExcelAllColumns(); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'The specified input column "id" does not exist in the given table', + ); + } + }); + + it('should diagnose error on transform type missmatch', async () => { + const text = readJvTestAsset('valid-transform-type-missmatch.jv'); + + const testTable = await readTestExcelAllColumns(); + const result = await parseAndExecuteExecutor(text, testTable); + + expect(R.isOk(result)).toEqual(false); + if (R.isErr(result)) { + expect(result.left.message).toEqual( + 'Type text of column "name" is not convertible to type integer', + ); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..af7b184be1b847220d6c83fb152e1f4618a6c4d3 GIT binary patch literal 5410 zcmaJ_2UJsAvnE0Ssi6r0kq$y=Qj}gqO6VYwD!m612wi#r3%xh#Eg~YKND+{(bRje; z(yNyu7OKDt-v3?reeXJF`DXUa=xX2-(Bcsj6XWqq8XDrA6H?r73zVIU zhmhduy*#l+yG@wv{+53v->)>*dYdQG)@HnA(soCv1Zj|$tvzV6(jp(cxY*%s>_ z6nt!5Jgte~pBCoUFn4wY$Tef{(!j4dGg@aB&2bWC}2uu$mTC8r$+_=cS>VShl0&p0)IJ znm2XJC^zfxgnbRv;ld7{{#qP?YMPt5bj+d_>QN>+KYNyGbTx>GBQnJ@H*p~JU%p$e4-y5pMk3*YzOF8Rqn6O~v{e{%e^*X9y-}--mB{I{3PDW)B?!9~ zQ4Q^kuBo}fcZF`z?b7r6!Gbd5MryG&453oPog|2_)4hqr`1_J=i;uw%KgeQ5+wY#($sd&* z4MxN=-U{O0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x&3;ncrBe@jr-3?zKPdRX+`ku%!}a?T4<$=S{R#qOsqy@WaD!%HCP~_vy4dUMwosdZ%iRIXm2lHoG^AA1hAV_N*_>VJ&31mXQy#-85HDd z;^d5EX1L;xn4AKe3Ck>rxIAJa%oBcamoirFaGFKebF%{DU* zyRQ-!^TKceG&o-#ZV!I&Uf|}%sU-QEChH%Gs(e(}&m{yZ?ZYI&JtZ|f23arC2I$r5V5j;M* z_><1>vKEX^D9@lnKaaC=0uSPfKRXa$MAK3$)9mAGm4B#B=ud1zfmc3RWvRn_gY2kH zk0`X*3Y@cB|0r(%Fd)y{KDm02fI(uq`H=40XQKsH;n*#mW2l)4rhRtcQ@YJuCxa&8 zNkOviv2C0_W6r`)@>35PicuC@;k?rbJoOOZ0xjOzIO_Za=5!qO-*Rp^^}FKvDaGl4 z=1h2SOa1$}=65^iJJ-{h#+k_A@(a$+`3cAG%I8~>Q-+<18^JH--&@_^4VeGM!1Ab`qLI3~& literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx.license b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-empty.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-excel.xlsx b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/test-excel.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8869be3b3295a65c8e97de17561b318956ff987c GIT binary patch literal 6132 zcmaJ_1z418(_WBXdO<=dk#0!=X^`&jTAE$h1(BAP?k;ITQd&R+kp}6MR!V9CDFy%K zobUSK^Z(D8z4m=~uj`$8pXZ)?W}X>!r8{UO04yvlK(ef<9^jS$k-yDgU?(^i=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qWCRZvP#UGU{~9AP!y{NKq_>&)30%L zQlhaC`_(#1k289hU4MDIEiq^lz8TEOv{w>YS0-33=)A#Y_!*>p#dIKWD3rm86Mtv= zTq^&eYd7jzCF+5`Pc35tw)=~H#0ROL_kUF8)jS5c`I!WXxVJ=a(a0@e-FHs8y7c2( z9sfOo#%dEF?iESa--lVV+g61?p;jS)U-bakLxymj2oe^sLz{}cG+T~raxooPjBXU@ z>5L!E#9gsj`{4f;lf~H&xc1jc*`8pK5r%Y^EXFm{QBX+$H{;RU6T$28=zq(tVdq!IQi!?|I?^)$01)} TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-column-type-change.jv b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-column-type-change.jv new file mode 100644 index 000000000..a85a6b2ad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-column-type-change.jv @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + transform ToBool { + from asInteger oftype integer; + to asBool oftype boolean; + + asBool: asInteger != 0; + } + + block TestExtractor oftype TestTableExtractor { + } + + block TestBlock oftype TableTransformer { + inputColumns: ['index']; + outputColumn: 'index'; + use: ToBool; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-missing-input-column.jv b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-missing-input-column.jv new file mode 100644 index 000000000..44e535ffc --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-missing-input-column.jv @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + transform Add { + from left oftype integer; + from right oftype integer; + to added oftype integer; + + added: left + right; + } + + block TestExtractor oftype TestTableExtractor { + } + + block TestBlock oftype TableTransformer { + inputColumns: ['index', 'id']; + outputColumn: 'add'; + use: Add; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transfomer.jv b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transfomer.jv new file mode 100644 index 000000000..856d8024b --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transfomer.jv @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + transform Double { + from original oftype integer; + to double oftype integer; + + double: original * 2; + } + + block TestExtractor oftype TestTableExtractor { + } + + block TestBlock oftype TableTransformer { + inputColumns: ['index']; + outputColumn: 'index2'; + use: Double; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transform-type-missmatch.jv b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transform-type-missmatch.jv new file mode 100644 index 000000000..52675e73d --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-transformer-executor/valid-transform-type-missmatch.jv @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + transform Double { + from original oftype integer; + to double oftype integer; + + double: original * 2; + } + + block TestExtractor oftype TestTableExtractor { + } + + block TestBlock oftype TableTransformer { + inputColumns: ['name']; + outputColumn: 'index2'; + use: Double; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx b/libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..565c89c28a6809f31cda1162b110d17a4774ced7 GIT binary patch literal 7978 zcmbVxbzD^6`tH!(Eg`LRHz*<9EdwImFrPR z`^SCfGkf;znf30yp7qvxUL{!=SX=-iA|imDPg4`{L{J{i-`g8oIj}H49?N4p6uMYZ z10imq^cP&q!iYJAEpk#V6r5yVsBMVrLh`!(j?drVV53HS?uxYY^tv-BSdp_~Tw$e^ z)eTYC3V{aG8hR9U58c_hvT%>&diG-RN~(aw=6{zd~&p z?im4ugoEtgsXMdZ83k|pYwd+&+nH+Q&UwMM`pa8ea@j~fC;9k_>|=l-xlU9x2CrnJ{4H&Cn)}k}LvZKq_bI!2<}R&;Wqae}(DU!#`ZCSpJ2S zGsxc300gpRcCohljT$(1$fAoCQ~crzneF;*{dG3((0sgTz4b3BQ8I1XdTNPD$-6cS z)n^F4JDrX+n=%d%5sv9iLy~S{l|8Vkk`W)GV=oVQ7q@kfY}UD|L~|MkJ#{k9>>5-2 zr=7BoG5UpygrVIO+X>XWW^0sB0JtLq)uLs|0k__++3Xo8brJIoeNLcG!7!Z-9Sb-%0Y77&Fz1sz z?iRJ(49T;>-cN5nnYMvyu<32Co8iS{MAJg4NJnNG>Yy?gu>lM_k|M0<49vKeSSFiZ ztd7dTs2co>n%PxwY~*~{ZrY&>pL<#{u`_`pWR<&Pt&|H$Nkk_Em9_29ST^Qu-dEBI zn7}3BOPQ5Ky`O+YQ_y`=VQ1MwT<0YGKnEh{RG}3TOB(5k^Uk{^1x2DCDG(p!;@LM1 zgeS6_n4Krh2EPp51I5Ts7E5L>92}oAs#Qd> zr%sm`7R!9a84)`FGW)YAVb}pyP^a_&)V5Hknc6SS(52z#Y1N9H3U;gFiH})4>Jf_3 zq6qrp^dZ$LNXW_8?&IWbCA4nRQo=Gp4sbZPFecl&1kXoZd^by% z>s4j}2Kwm|u0(!(4&S8=@@Uajy^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t)FUUqWJwH6tDpZaZK~Y3$gUnhNqsPh{|?)uIcST4Y#fbk z9N(+C+8R5&dql1$L0;956*CZWiziosp1_4eeno~66E?{K8pnym9jI3`3sJMx=`3NP`_PC_@S|CF8Iff z?#Rkm1AX4r5M%Nf`_@;3w@aV+H zt(6XxDI@6vH3f~)yJ{mRG%|b!$uKL7>bIDe_`{TT9IOWFgsxMvjjIvXat}Ubf;3yr z%#tnv76*1sXk+BbY~K%(zrg-da~93RxtNpyYHH7wv4@!!;A7F=W4RE_M-(2X7e$vi z(kWqUS$iAT!`hmyM8)XokgW?WRgDWuf`u;GCB0{?>8pxtW(jV4RNQW>s5|KA7yfB34uwLGma{!`1xhvfI~ z=|9!-dyDY5mZ#bDu@?Cw(s=)x#^066-x{8V`p2yMM{@9=hWCHx;J=4Iji~>*5E2iw z`d_lc-wK|_mdC*RN63htDEN06{(JOO3;)mCt3TN0{}PRqWZ@p10RTXKcp*HLAZR3y G-~I=+53m>j literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/util.ts b/libs/extensions/tabular/exec/test/util.ts index 3ee482362..68180db6f 100644 --- a/libs/extensions/tabular/exec/test/util.ts +++ b/libs/extensions/tabular/exec/test/util.ts @@ -4,9 +4,20 @@ import * as path from 'path'; -import { Workbook } from '@jvalue/jayvee-execution'; +import { + Table, + TableRow, + Workbook, + parseValueToInternalRepresentation, +} from '@jvalue/jayvee-execution'; +import { + InternalValueRepresentation, + Valuetype, +} from '@jvalue/jayvee-language-server'; import * as exceljs from 'exceljs'; +import { ColumnDefinitionEntry } from '../src/lib/table-interpreter-executor'; + export async function createWorkbookFromLocalExcelFile( fileName: string, ): Promise { @@ -37,3 +48,77 @@ export async function createWorkbookFromLocalExcelFile( return workbook; } + +export type ReducedColumnDefinitionEntry = Pick< + ColumnDefinitionEntry, + 'sheetColumnIndex' | 'columnName' | 'valuetype' +>; + +/** + * Creates a Table from the first sheet of the excel file pointed to by {@link fileName} + * and parsed using the given column definitions. + * Note: The parsing is static and thus cannot detect runtime types! + * @param fileName + * @param columnDefinitions columns to be read from table (no header matching) + * @returns Table containing data of excel + */ +export async function createTableFromLocalExcelFile( + fileName: string, + columnDefinitions: ReducedColumnDefinitionEntry[], +): Promise { + const workBookFromFile = new exceljs.Workbook(); + await workBookFromFile.xlsx.readFile(path.resolve(__dirname, fileName)); + + const workSheet = workBookFromFile.worksheets[0] as exceljs.Worksheet; + const table = new Table(); + + columnDefinitions.forEach((columnDefinition) => { + table.addColumn(columnDefinition.columnName, { + values: [], + valuetype: columnDefinition.valuetype, + }); + }); + + workSheet.eachRow((row) => { + const tableRow = constructTableRow(row, columnDefinitions); + table.addRow(tableRow); + }); + + return table; +} +function constructTableRow( + row: exceljs.Row, + columnDefinitions: ReducedColumnDefinitionEntry[], +): TableRow { + const tableRow: TableRow = {}; + + row.eachCell( + { includeEmpty: true }, + (cell: exceljs.Cell, colNumber: number) => { + if (colNumber > columnDefinitions.length) return; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const columnDefinition = columnDefinitions[colNumber - 1]!; + const value = cell.text; + const valuetype = columnDefinition.valuetype; + + const parsedValue = parseAndValidatePrimitiveValue(value, valuetype); + if (parsedValue === undefined) { + return; + } + + tableRow[columnDefinition.columnName] = parsedValue; + }, + ); + return tableRow; +} +function parseAndValidatePrimitiveValue( + value: string, + valuetype: Valuetype, +): InternalValueRepresentation | undefined { + const parsedValue = parseValueToInternalRepresentation(value, valuetype); + if (parsedValue === undefined) { + return undefined; + } + + return parsedValue; +} From 81941d7beb0499c5f8ce46711a573822b4267548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 11:26:52 +0100 Subject: [PATCH 19/25] Added tests for XLSXInterpreterExecutor --- .../src/lib/xlsx-interpreter-executor.spec.ts | 137 ++++++++++++++++++ .../xlsx-interpreter-executor/test-empty.xlsx | Bin 0 -> 5410 bytes .../test-empty.xlsx.license | 3 + .../xlsx-interpreter-executor/test-excel.xlsx | Bin 0 -> 6132 bytes .../test-excel.xlsx.license | 3 + .../test-multiple-sheets.xlsx | Bin 0 -> 8141 bytes .../test-multiple-sheets.xlsx.license | 3 + .../valid-excel-interpreter.jv | 16 ++ 8 files changed, 162 insertions(+) create mode 100644 libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-excel.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-excel.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-multiple-sheets.xlsx create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-multiple-sheets.xlsx.license create mode 100644 libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/valid-excel-interpreter.jv diff --git a/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts new file mode 100644 index 000000000..c2c230f8c --- /dev/null +++ b/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +import * as path from 'path'; + +import * as R from '@jvalue/jayvee-execution'; +import { + createBinaryFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; +import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; +import { + BlockDefinition, + IOType, + createJayveeServices, + useExtension, +} from '@jvalue/jayvee-language-server'; +import { + ParseHelperOptions, + TestLangExtension, + expectNoParserAndLexerErrors, + parseHelper, + readJvTestAssetHelper, +} from '@jvalue/jayvee-language-server/test'; +import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; +import { NodeFileSystem } from 'langium/node'; + +import { XLSXInterpreterExecutor } from './xlsx-interpreter-executor'; + +describe('Validation of XLSXInterpreterExecutor', () => { + let parse: ( + input: string, + options?: ParseHelperOptions, + ) => Promise>; + + let locator: AstNodeLocator; + + const readJvTestAsset = readJvTestAssetHelper( + __dirname, + '../../test/assets/xlsx-interpreter-executor/', + ); + + function readTestFile(fileName: string): R.BinaryFile { + const absoluteFileName = path.resolve( + __dirname, + '../../test/assets/xlsx-interpreter-executor/', + fileName, + ); + return createBinaryFileFromLocalFile(absoluteFileName); + } + + function expectSheetRowAndColumnSize( + sheet: R.Sheet | undefined, + cols: number, + rows: number, + ) { + expect(sheet?.getNumberOfColumns()).toEqual(cols); + expect(sheet?.getNumberOfRows()).toEqual(rows); + } + + async function parseAndExecuteExecutor( + input: string, + IOInput: R.BinaryFile, + ): Promise> { + const document = await parse(input, { validationChecks: 'all' }); + expectNoParserAndLexerErrors(document); + + const block = locator.getAstNode( + document.parseResult.value, + 'pipelines@0/blocks@1', + ) as BlockDefinition; + + return new XLSXInterpreterExecutor().doExecute( + IOInput, + getTestExecutionContext(locator, document, [block]), + ); + } + + beforeAll(() => { + // Register extensions + useExtension(new TabularLangExtension()); + useExtension(new TestLangExtension()); + // Create language services + const services = createJayveeServices(NodeFileSystem).Jayvee; + locator = services.workspace.AstNodeLocator; + // Parse function for Jayvee (without validation) + parse = parseHelper(services); + }); + + it('should diagnose no error on single sheet excel', async () => { + const text = readJvTestAsset('valid-excel-interpreter.jv'); + + const testFile = readTestFile('test-excel.xlsx'); + const result = await parseAndExecuteExecutor(text, testFile); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.WORKBOOK); + const sheets = result.right.getSheets(); + expect(sheets.size).toEqual(1); + expectSheetRowAndColumnSize(sheets.get('Sheet1'), 3, 6); + } + }); + + it('should diagnose no error on multiple sheet excel', async () => { + const text = readJvTestAsset('valid-excel-interpreter.jv'); + + const testFile = readTestFile('test-multiple-sheets.xlsx'); + const result = await parseAndExecuteExecutor(text, testFile); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.WORKBOOK); + const sheets = result.right.getSheets(); + expect(sheets.size).toEqual(3); + expectSheetRowAndColumnSize(sheets.get('Sheet1'), 3, 6); + expectSheetRowAndColumnSize(sheets.get('CustomSheet'), 0, 0); + expectSheetRowAndColumnSize(sheets.get('Sheet3'), 0, 0); + } + }); + + it('should diagnose no error on empty excel', async () => { + const text = readJvTestAsset('valid-excel-interpreter.jv'); + + const testFile = readTestFile('test-empty.xlsx'); + const result = await parseAndExecuteExecutor(text, testFile); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.WORKBOOK); + const sheets = result.right.getSheets(); + expect(sheets.size).toEqual(1); + expectSheetRowAndColumnSize(sheets.get('Sheet1'), 0, 0); + } + }); +}); diff --git a/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..af7b184be1b847220d6c83fb152e1f4618a6c4d3 GIT binary patch literal 5410 zcmaJ_2UJsAvnE0Ssi6r0kq$y=Qj}gqO6VYwD!m612wi#r3%xh#Eg~YKND+{(bRje; z(yNyu7OKDt-v3?reeXJF`DXUa=xX2-(Bcsj6XWqq8XDrA6H?r73zVIU zhmhduy*#l+yG@wv{+53v->)>*dYdQG)@HnA(soCv1Zj|$tvzV6(jp(cxY*%s>_ z6nt!5Jgte~pBCoUFn4wY$Tef{(!j4dGg@aB&2bWC}2uu$mTC8r$+_=cS>VShl0&p0)IJ znm2XJC^zfxgnbRv;ld7{{#qP?YMPt5bj+d_>QN>+KYNyGbTx>GBQnJ@H*p~JU%p$e4-y5pMk3*YzOF8Rqn6O~v{e{%e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igb^)UJS>cixTIb@A{j=n0k~V@I%1HejcYU$g{??53c|eks z!HC{?1kFBsfaL!6XYnHq3fq~jy=f$yziVNT!zBIbxiB}17m|kC^)~MF@69Oa{Cios zx&3;ncrBe@jr-3?zKPdRX+`ku%!}a?T4<$=S{R#qOsqy@WaD!%HCP~_vy4dUMwosdZ%iRIXm2lHoG^AA1hAV_N*_>VJ&31mXQy#-85HDd z;^d5EX1L;xn4AKe3Ck>rxIAJa%oBcamoirFaGFKebF%{DU* zyRQ-!^TKceG&o-#ZV!I&Uf|}%sU-QEChH%Gs(e(}&m{yZ?ZYI&JtZ|f23arC2I$r5V5j;M* z_><1>vKEX^D9@lnKaaC=0uSPfKRXa$MAK3$)9mAGm4B#B=ud1zfmc3RWvRn_gY2kH zk0`X*3Y@cB|0r(%Fd)y{KDm02fI(uq`H=40XQKsH;n*#mW2l)4rhRtcQ@YJuCxa&8 zNkOviv2C0_W6r`)@>35PicuC@;k?rbJoOOZ0xjOzIO_Za=5!qO-*Rp^^}FKvDaGl4 z=1h2SOa1$}=65^iJJ-{h#+k_A@(a$+`3cAG%I8~>Q-+<18^JH--&@_^4VeGM!1Ab`qLI3~& literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx.license b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-empty.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-excel.xlsx b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-excel.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8869be3b3295a65c8e97de17561b318956ff987c GIT binary patch literal 6132 zc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e(`7wsG$SvSbU8w9uE}wnzT?v=#h2#kbytzs92VyqXeznnq*Tuz zHFgPEi-v(|PBIrcqUb)X1C_2Bq3cCR)*JIV8$$0p_dUZT7Ps5Yl_Ot1BPt1f;}rhr z@{zN*lx3?sX0GcYA!dg~P@AUKr@0jUD?LD`0AC#H+?=Xk-|Z7M90FCzg7gqxYnm7Y zKTC9hiJK1J8N!^&YWw<|3plIrgp$7ZT5~7}UTAmM1J|Sv$7FDF%x!ajL<|4gc7N#h z{W>OhS2vL3&j2x2htdPY3;nWGiu8Fw12JK;;U%Ad#(Dg56O1cpQ1PXo4^7a1Y&eCm z(v;ARL?zZ|Y`azt7A622ItBw9=%$!Yu6t8wS3s7C$W$!}e8I;c7J90iGcukb%jUznbRB+pYTH^PXmpo%;8ds0?ogJ0mG1z1r09wlUE6%d;Kayn92?t~f2s-r= z!>QXXvf-zTl2<6n`fflnWh=msd{nJ&i#`eVZy3XZXci_kQjhS`ZTDG>)`_= zP9QPxo5z5aFJ0m{kKN8zhaUsI>#=pyNlSdVWzc2iK zzVtAC`y~wbxBBN<+@CnVj};!KQNP6a-u2w${63rdbMf!};s@jVCAIgJ=KbP7=MaAa z{N7}HXe<8`ynAKc1N>?-|GD({diJ4e{Uwwr|NF=PPfzYol;5-QzoQ&t{8yBpmGGY^ zzo!v@NAbe>uP8tB_&-s856urL$1i~=_)8goCLn(z{2nzPLijH^zeo5LDgG1C|6KmN zbN>5r=HBn>*Yf`jG=Bp8?xr4m_%HDw{te(i9{tbNzw_kpx39Xl@c-i2R21M59&Ukt O|4_Wo;_MzjeEJ_A?d(zj literal 0 HcmV?d00001 diff --git a/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-multiple-sheets.xlsx.license b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-multiple-sheets.xlsx.license new file mode 100644 index 000000000..17c5d2bad --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/test-multiple-sheets.xlsx.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg + +SPDX-License-Identifier: AGPL-3.0-only diff --git a/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/valid-excel-interpreter.jv b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/valid-excel-interpreter.jv new file mode 100644 index 000000000..a267981e2 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/xlsx-interpreter-executor/valid-excel-interpreter.jv @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + block TestExtractor oftype TestFileExtractor { + } + + block TestBlock oftype XLSXInterpreter { + } + + block TestLoader oftype TestWorkbookLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From aa99e1804b321478946261783d7a59ccfa01976f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 12:15:26 +0100 Subject: [PATCH 20/25] removed unnecessary test file --- .../test-multiple-sheet-all-cell-formats.xlsx | Bin 7978 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx diff --git a/libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx b/libs/extensions/tabular/exec/test/assets/test-multiple-sheet-all-cell-formats.xlsx deleted file mode 100644 index 565c89c28a6809f31cda1162b110d17a4774ced7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7978 zcmbVxbzD^6`tH!(Eg`LRHz*<9EdwImFrPR z`^SCfGkf;znf30yp7qvxUL{!=SX=-iA|imDPg4`{L{J{i-`g8oIj}H49?N4p6uMYZ z10imq^cP&q!iYJAEpk#V6r5yVsBMVrLh`!(j?drVV53HS?uxYY^tv-BSdp_~Tw$e^ z)eT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z(kWqUS$iAT!`hmyM8)XokgW?WRgDWuf`u;GCB0{?>8pxtW(jV4RNQW>s5|KA7yfB34uwLGma{!`1xhvfI~ z=|9!-dyDY5mZ#bDu@?Cw(s=)x#^066-x{8V`p2yMM{@9=hWCHx;J=4Iji~>*5E2iw z`d_lc-wK|_mdC*RN63htDEN06{(JOO3;)mCt3TN0{}PRqWZ@p10RTXKcp*HLAZR3y G-~I=+53m>j From 2240655e1c0c000635aaa05177cfb3eaab6eae43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 12:18:14 +0100 Subject: [PATCH 21/25] Added missing export of interface --- .../tabular/exec/src/lib/table-interpreter-executor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.ts b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.ts index fb7da129c..77a4df8db 100644 --- a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.ts +++ b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.ts @@ -27,7 +27,7 @@ import { rowIndexToString, } from '@jvalue/jayvee-language-server'; -interface ColumnDefinitionEntry { +export interface ColumnDefinitionEntry { sheetColumnIndex: number; columnName: string; valuetype: Valuetype; From f941c08ed57a9d7987a7d149af3e367192b85f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 30 Oct 2023 12:28:10 +0100 Subject: [PATCH 22/25] Added tests for TableInterpreterExecutor with empty columns input --- .../lib/table-interpreter-executor.spec.ts | 34 +++++++++++++++++++ .../valid-empty-columns-with-header.jv | 19 +++++++++++ .../valid-empty-columns-without-header.jv | 19 +++++++++++ 3 files changed, 72 insertions(+) create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-with-header.jv create mode 100644 libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-without-header.jv diff --git a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts index 4f543a5d0..2d1c2b165 100644 --- a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts @@ -111,6 +111,23 @@ describe('Validation of TableInterpreterExecutor', () => { } }); + it('should diagnose empty table on empty column parameter', async () => { + const text = readJvTestAsset('valid-empty-columns-with-header.jv'); + + const testWorkbook = await readTestWorkbook('test-with-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(0); + expect(result.right.getNumberOfRows()).toEqual(16); + } + }); + it('should diagnose empty table on wrong header case', async () => { const text = readJvTestAsset('valid-with-capitalized-header.jv'); @@ -228,6 +245,23 @@ describe('Validation of TableInterpreterExecutor', () => { } }); + it('should diagnose empty table on empty column parameter', async () => { + const text = readJvTestAsset('valid-empty-columns-without-header.jv'); + + const testWorkbook = await readTestWorkbook('test-without-header.xlsx'); + const result = await parseAndExecuteExecutor( + text, + testWorkbook.getSheetByName('Sheet1') as R.Sheet, + ); + + expect(R.isErr(result)).toEqual(false); + if (R.isOk(result)) { + expect(result.right.ioType).toEqual(IOType.TABLE); + expect(result.right.getNumberOfColumns()).toEqual(0); + expect(result.right.getNumberOfRows()).toEqual(16); + } + }); + it('should diagnose error on empty sheet', async () => { const text = readJvTestAsset('valid-without-header.jv'); diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-with-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-with-header.jv new file mode 100644 index 000000000..7e46a44c6 --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-with-header.jv @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: true; + columns: []; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} diff --git a/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-without-header.jv b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-without-header.jv new file mode 100644 index 000000000..b6e423edc --- /dev/null +++ b/libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-empty-columns-without-header.jv @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +pipeline TestPipeline { + + block TestExtractor oftype TestSheetExtractor { + } + + block TestBlock oftype TableInterpreter { + header: false; + columns: []; + } + + block TestLoader oftype TestTableLoader { + } + + TestExtractor -> TestBlock -> TestLoader; +} From 9290f97d20ae9dcc802e9aaddc1acc92169ae8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 13 Nov 2023 09:15:54 +0100 Subject: [PATCH 23/25] Fixed merge --- .../src/lib/util}/file-util.spec.ts | 2 +- libs/execution/test/utils/file-util.ts | 6 +-- .../src/archive-interpreter-executor.spec.ts | 7 +-- .../std/exec/src/file-picker-executor.spec.ts | 7 +-- .../src/gtfs-rt-interpreter-executor.spec.ts | 7 +-- libs/extensions/std/exec/src/string-util.ts | 14 ------ .../text-file-interpreter-executor.spec.ts | 7 +-- .../src/text-line-deleter-executor.spec.ts | 7 +-- .../src/text-range-selector-executor.spec.ts | 7 +-- libs/extensions/std/exec/test/index.ts | 1 - libs/extensions/std/exec/test/utils.ts | 47 ------------------- 11 files changed, 28 insertions(+), 84 deletions(-) rename libs/{extensions/std/exec/src => execution/src/lib/util}/file-util.spec.ts (97%) delete mode 100644 libs/extensions/std/exec/src/string-util.ts delete mode 100644 libs/extensions/std/exec/test/utils.ts diff --git a/libs/extensions/std/exec/src/file-util.spec.ts b/libs/execution/src/lib/util/file-util.spec.ts similarity index 97% rename from libs/extensions/std/exec/src/file-util.spec.ts rename to libs/execution/src/lib/util/file-util.spec.ts index decef2317..5d3074157 100644 --- a/libs/extensions/std/exec/src/file-util.spec.ts +++ b/libs/execution/src/lib/util/file-util.spec.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0-only -import { FileExtension, MimeType } from '@jvalue/jayvee-execution'; +import { FileExtension, MimeType } from '../types'; import { inferFileExtensionFromContentTypeString, diff --git a/libs/execution/test/utils/file-util.ts b/libs/execution/test/utils/file-util.ts index 35ace2292..be8689515 100644 --- a/libs/execution/test/utils/file-util.ts +++ b/libs/execution/test/utils/file-util.ts @@ -11,14 +11,14 @@ import { MimeType, TextFile, inferFileExtensionFromFileExtensionString, - inferMimeTypeFromContentTypeString, + inferMimeTypeFromFileExtensionString, splitLines, } from '../../src'; export function createBinaryFileFromLocalFile(fileName: string): BinaryFile { const extName = path.extname(fileName); const mimeType = - inferMimeTypeFromContentTypeString(extName) || + inferMimeTypeFromFileExtensionString(extName) || MimeType.APPLICATION_OCTET_STREAM; const fileExtension = inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; @@ -29,7 +29,7 @@ export function createBinaryFileFromLocalFile(fileName: string): BinaryFile { export function createTextFileFromLocalFile(fileName: string): TextFile { const extName = path.extname(fileName); const mimeType = - inferMimeTypeFromContentTypeString(extName) || + inferMimeTypeFromFileExtensionString(extName) || MimeType.APPLICATION_OCTET_STREAM; const fileExtension = inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; diff --git a/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts index 7b174ae11..ae4eb2fcd 100644 --- a/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createBinaryFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createBinaryFileFromLocalFile } from '../test'; - import { ArchiveInterpreterExecutor } from './archive-interpreter-executor'; describe('Validation of ArchiveInterpreterExecutor', () => { diff --git a/libs/extensions/std/exec/src/file-picker-executor.spec.ts b/libs/extensions/std/exec/src/file-picker-executor.spec.ts index 8fd8e3578..f89119a76 100644 --- a/libs/extensions/std/exec/src/file-picker-executor.spec.ts +++ b/libs/extensions/std/exec/src/file-picker-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createBinaryFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createBinaryFileFromLocalFile } from '../test'; - import { FilePickerExecutor } from './file-picker-executor'; describe('Validation of FilePickerExecutor', () => { diff --git a/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts index 75d8ae8d9..65cdcfb86 100644 --- a/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createBinaryFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createBinaryFileFromLocalFile } from '../test'; - import { GtfsRTInterpreterExecutor } from './gtfs-rt-interpreter-executor'; describe('Validation of GtfsRTInterpreterExecutor', () => { diff --git a/libs/extensions/std/exec/src/string-util.ts b/libs/extensions/std/exec/src/string-util.ts deleted file mode 100644 index 55b7d78b0..000000000 --- a/libs/extensions/std/exec/src/string-util.ts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg -// -// SPDX-License-Identifier: AGPL-3.0-only - -export function splitLines(textContent: string, lineBreak: RegExp): string[] { - const lines = textContent.split(lineBreak); - - // There may be an additional empty line due to the previous splitting - if (lines[lines.length - 1] === '') { - lines.splice(lines.length - 1, 1); - } - - return lines; -} diff --git a/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts index 342bceeab..0c9fd6462 100644 --- a/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createBinaryFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createBinaryFileFromLocalFile } from '../test'; - import { TextFileInterpreterExecutor } from './text-file-interpreter-executor'; describe('Validation of TextFileInterpreterExecutor', () => { diff --git a/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts b/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts index 8ca8a191e..156151fce 100644 --- a/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createTextFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createTextFileFromLocalFile } from '../test'; - import { TextLineDeleterExecutor } from './text-line-deleter-executor'; describe('Validation of TextLineDeleterExecutor', () => { diff --git a/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts b/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts index 73e333359..b9ad72c15 100644 --- a/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts @@ -5,7 +5,10 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; -import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; +import { + createTextFileFromLocalFile, + getTestExecutionContext, +} from '@jvalue/jayvee-execution/test'; import { BlockDefinition, IOType, @@ -21,8 +24,6 @@ import { import { AstNode, AstNodeLocator, LangiumDocument } from 'langium'; import { NodeFileSystem } from 'langium/node'; -import { createTextFileFromLocalFile } from '../test'; - import { TextRangeSelectorExecutor } from './text-range-selector-executor'; describe('Validation of TextRangeSelectorExecutor', () => { diff --git a/libs/extensions/std/exec/test/index.ts b/libs/extensions/std/exec/test/index.ts index cfe12da6f..460aca6a3 100644 --- a/libs/extensions/std/exec/test/index.ts +++ b/libs/extensions/std/exec/test/index.ts @@ -3,4 +3,3 @@ // SPDX-License-Identifier: AGPL-3.0-only export * from './mocks'; -export * from './utils'; diff --git a/libs/extensions/std/exec/test/utils.ts b/libs/extensions/std/exec/test/utils.ts deleted file mode 100644 index 7b7d43d5b..000000000 --- a/libs/extensions/std/exec/test/utils.ts +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg -// -// SPDX-License-Identifier: AGPL-3.0-only - -import { readFileSync } from 'fs'; -import * as path from 'path'; - -import { - BinaryFile, - FileExtension, - MimeType, - TextFile, -} from '@jvalue/jayvee-execution'; - -import { - inferFileExtensionFromFileExtensionString, - inferMimeTypeFromFileExtensionString, -} from '../src/file-util'; -import { splitLines } from '../src/string-util'; - -export function createBinaryFileFromLocalFile(fileName: string): BinaryFile { - const extName = path.extname(fileName); - const mimeType = - inferMimeTypeFromFileExtensionString(extName) || - MimeType.APPLICATION_OCTET_STREAM; - const fileExtension = - inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; - const file = readFileSync(path.resolve(__dirname, fileName)); - return new BinaryFile(path.basename(fileName), fileExtension, mimeType, file); -} - -export function createTextFileFromLocalFile(fileName: string): TextFile { - const extName = path.extname(fileName); - const mimeType = - inferMimeTypeFromFileExtensionString(extName) || - MimeType.APPLICATION_OCTET_STREAM; - const fileExtension = - inferFileExtensionFromFileExtensionString(extName) || FileExtension.NONE; - const fileContent = readFileSync(path.resolve(__dirname, fileName), 'utf-8'); - - return new TextFile( - path.basename(fileName), - fileExtension, - mimeType, - splitLines(fileContent, /\r?\n/), - ); -} From 078c4a913c938c53c25390c077007e6b63addc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 13 Nov 2023 09:31:39 +0100 Subject: [PATCH 24/25] Applied new TestExtension loading --- .../lib/cell-range-selector-executor.spec.ts | 12 +++--- .../exec/src/lib/cell-writer-executor.spec.ts | 12 +++--- .../src/lib/column-deleter-executor.spec.ts | 12 +++--- .../src/lib/csv-interpreter-executor.spec.ts | 12 +++--- .../exec/src/lib/row-deleter-executor.spec.ts | 12 +++--- .../src/lib/sheet-picker-executor.spec.ts | 12 +++--- .../lib/table-interpreter-executor.spec.ts | 12 +++--- .../lib/table-transformer-executor.spec.ts | 12 +++--- .../src/lib/xlsx-interpreter-executor.spec.ts | 12 +++--- .../test/test-extension/TestBlockTypes.jv | 43 +++++++++++++++++++ 10 files changed, 88 insertions(+), 63 deletions(-) create mode 100644 libs/extensions/tabular/exec/test/test-extension/TestBlockTypes.jv diff --git a/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts index a230f3356..c39d6a3c4 100644 --- a/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/cell-range-selector-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of CellRangeSelectorExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts index 28479475f..99ac1d493 100644 --- a/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/cell-writer-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of CellWriterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts index e9e6ba32e..7150e817e 100644 --- a/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/column-deleter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of ColumnDeleterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts index 8405f395f..c4a8b938e 100644 --- a/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.spec.ts @@ -9,17 +9,15 @@ import { createTextFileFromLocalFile, getTestExecutionContext, } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -68,12 +66,12 @@ describe('Validation of CSVInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts index c91382169..03bea0917 100644 --- a/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/row-deleter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of RowDeleterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts index 9dfba7ea0..4af35e9f5 100644 --- a/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/sheet-picker-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of SheetPickerExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts index 2d1c2b165..ff21a70e4 100644 --- a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of TableInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts index 4ea0dce63..a2763b1ff 100644 --- a/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/table-transformer-executor.spec.ts @@ -6,18 +6,16 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, PrimitiveValuetypes, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -96,12 +94,12 @@ describe('Validation of TableTransformerExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts index c2c230f8c..f289ea96d 100644 --- a/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/xlsx-interpreter-executor.spec.ts @@ -9,17 +9,15 @@ import { createBinaryFileFromLocalFile, getTestExecutionContext, } from '@jvalue/jayvee-execution/test'; -import { TabularLangExtension } from '@jvalue/jayvee-extensions/tabular/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -77,12 +75,12 @@ describe('Validation of XLSXInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new TabularLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/tabular/exec/test/test-extension/TestBlockTypes.jv b/libs/extensions/tabular/exec/test/test-extension/TestBlockTypes.jv new file mode 100644 index 000000000..ba08556c4 --- /dev/null +++ b/libs/extensions/tabular/exec/test/test-extension/TestBlockTypes.jv @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +builtin blocktype TestSheetExtractor { + input inPort oftype None; + output outPort oftype Sheet; +} + +builtin blocktype TestSheetLoader { + input inPort oftype Sheet; + output outPort oftype None; +} + +builtin blocktype TestTextFileExtractor { + input inPort oftype None; + output outPort oftype TextFile; +} + +builtin blocktype TestFileExtractor { + input inPort oftype None; + output outPort oftype File; +} + +builtin blocktype TestWorkbookExtractor { + input inPort oftype None; + output outPort oftype Workbook; +} + +builtin blocktype TestWorkbookLoader { + input inPort oftype Workbook; + output outPort oftype None; +} + +builtin blocktype TestTableExtractor { + input inPort oftype None; + output outPort oftype Table; +} + +builtin blocktype TestTableLoader { + input inPort oftype Table; + output outPort oftype None; +} From f9b29188c97526776b1f26cf566095e3f8b8ae43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 13 Nov 2023 13:20:32 +0100 Subject: [PATCH 25/25] Adjusted tests to table rowCount bugfix --- .../tabular/exec/src/lib/table-interpreter-executor.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts index ff21a70e4..feb52fac5 100644 --- a/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts +++ b/libs/extensions/tabular/exec/src/lib/table-interpreter-executor.spec.ts @@ -122,7 +122,7 @@ describe('Validation of TableInterpreterExecutor', () => { if (R.isOk(result)) { expect(result.right.ioType).toEqual(IOType.TABLE); expect(result.right.getNumberOfColumns()).toEqual(0); - expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getNumberOfRows()).toEqual(0); } }); @@ -139,7 +139,7 @@ describe('Validation of TableInterpreterExecutor', () => { if (R.isOk(result)) { expect(result.right.ioType).toEqual(IOType.TABLE); expect(result.right.getNumberOfColumns()).toEqual(0); - expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getNumberOfRows()).toEqual(0); } }); @@ -256,7 +256,7 @@ describe('Validation of TableInterpreterExecutor', () => { if (R.isOk(result)) { expect(result.right.ioType).toEqual(IOType.TABLE); expect(result.right.getNumberOfColumns()).toEqual(0); - expect(result.right.getNumberOfRows()).toEqual(16); + expect(result.right.getNumberOfRows()).toEqual(0); } });