From 980581193cdcceaa80cd87f91e86121726c1046f Mon Sep 17 00:00:00 2001 From: Kevin F Date: Fri, 20 Oct 2023 16:39:19 +0200 Subject: [PATCH] Setup current FsSpreadsheet.Exceljs write for defaultio tests :construction: --- src/FsSpreadsheet.Exceljs/Worksheet.fs | 4 ++-- .../DefaultIO.Tests.fs | 2 +- .../DefaultIO.Tests.fs | 2 +- tests/TestUtils/DefaultTestObjects.fs | 6 ++++-- .../TestFiles/Scripts/fsSpreadsheet.fsx | 2 +- .../TestFiles/Scripts/fsSpreadsheet.js | 14 ++++++++++++++ ...readsheet.cmd => runFsSpreadsheet.fsx.cmd} | 0 .../TestFiles/Scripts/runFsSpreadsheet.js.cmd | 3 +++ .../TestFiles/TestWorkbook_FableExceljs.xlsx | Bin 10698 -> 10698 bytes ...sx => TestWorkbook_FsSpreadsheet.net.xlsx} | Bin 5325 -> 5327 bytes 10 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.js rename tests/TestUtils/TestFiles/Scripts/{runFsSpreadsheet.cmd => runFsSpreadsheet.fsx.cmd} (100%) create mode 100644 tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.js.cmd rename tests/TestUtils/TestFiles/{TestWorkbook_FsSpreadsheet.xlsx => TestWorkbook_FsSpreadsheet.net.xlsx} (55%) diff --git a/src/FsSpreadsheet.Exceljs/Worksheet.fs b/src/FsSpreadsheet.Exceljs/Worksheet.fs index b7124314..ed84e4c2 100644 --- a/src/FsSpreadsheet.Exceljs/Worksheet.fs +++ b/src/FsSpreadsheet.Exceljs/Worksheet.fs @@ -85,8 +85,8 @@ module JsWorksheet = log msg anyElse |> createFscell DataType.String | ValueType.Hyperlink -> - log (c.value.Value?text) - vTemp |> createFscell DataType.String + //log (c.value.Value?text) + c.value.Value?hyperlink |> createFscell DataType.String | anyElse -> let msg = sprintf "ValueType `%A` (%s) is not fully implemented in FsSpreadsheet and is handled as string input. In %s: (%i,%i)" anyElse vTemp jsws.name rowIndex columnIndex log msg diff --git a/tests/FsSpreadsheet.ExcelIO.Tests/DefaultIO.Tests.fs b/tests/FsSpreadsheet.ExcelIO.Tests/DefaultIO.Tests.fs index e837d505..989d1f21 100644 --- a/tests/FsSpreadsheet.ExcelIO.Tests/DefaultIO.Tests.fs +++ b/tests/FsSpreadsheet.ExcelIO.Tests/DefaultIO.Tests.fs @@ -30,7 +30,7 @@ let tests_Read = testList "Read" [ let wb = readFromTestFile DefaultTestObject.TestFiles.ClosedXML Expect.isDefaultTestObject wb testCase "FsSpreadsheet" <| fun _ -> - let wb = readFromTestFile DefaultTestObject.TestFiles.FsSpreadsheet + let wb = readFromTestFile DefaultTestObject.TestFiles.FsSpreadsheetNET Expect.isDefaultTestObject wb ] diff --git a/tests/FsSpreadsheet.Exceljs.Tests/DefaultIO.Tests.fs b/tests/FsSpreadsheet.Exceljs.Tests/DefaultIO.Tests.fs index 5f6a1083..3b1604c7 100644 --- a/tests/FsSpreadsheet.Exceljs.Tests/DefaultIO.Tests.fs +++ b/tests/FsSpreadsheet.Exceljs.Tests/DefaultIO.Tests.fs @@ -26,7 +26,7 @@ let tests_Read = testList "Read" [ Expect.isDefaultTestObject wb } testCaseAsync "FsSpreadsheet" <| async { - let! wb = readFromTestFile DefaultTestObject.TestFiles.FsSpreadsheet |> Async.AwaitPromise + let! wb = readFromTestFile DefaultTestObject.TestFiles.FsSpreadsheetNET |> Async.AwaitPromise Expect.isDefaultTestObject wb } ] \ No newline at end of file diff --git a/tests/TestUtils/DefaultTestObjects.fs b/tests/TestUtils/DefaultTestObjects.fs index 01bfc047..a607826a 100644 --- a/tests/TestUtils/DefaultTestObjects.fs +++ b/tests/TestUtils/DefaultTestObjects.fs @@ -16,7 +16,8 @@ type TestFiles = | Libre | FableExceljs | ClosedXML -| FsSpreadsheet +| FsSpreadsheetNET +| FsSpreadsheetJS member this.asFileName = match this with @@ -24,7 +25,8 @@ type TestFiles = | Libre -> "TestWorkbook_Libre.xlsx" | FableExceljs -> "TestWorkbook_FableExcelJS.xlsx" | ClosedXML -> "TestWorkbook_ClosedXML.xlsx" - | FsSpreadsheet -> "TestWorkbook_FsSpreadsheet.xlsx" + | FsSpreadsheetNET -> "TestWorkbook_FsSpreadsheet.net.xlsx" + | FsSpreadsheetJS -> "TestWorkbook_FsSpreadsheet.js.xlsx" member this.asRelativePath = $"../TestUtils/{testFolder}/{this.asFileName}" member this.asRelativePathNode = $"./tests/TestUtils/{testFolder}/{this.asFileName}" diff --git a/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.fsx b/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.fsx index 6de3ddc3..0e7349d7 100644 --- a/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.fsx +++ b/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.fsx @@ -9,7 +9,7 @@ open FsSpreadsheet.ExcelIO let inputPath = @"../TestWorkbook_Excel.xlsx" -let outputPath = @"../TestWorkbook_FsSpreadsheet.xlsx" +let outputPath = @"../TestWorkbook_FsSpreadsheet.net.xlsx" let wb = FsWorkbook.fromXlsxFile (inputPath) diff --git a/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.js b/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.js new file mode 100644 index 00000000..11ed0b0f --- /dev/null +++ b/tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.js @@ -0,0 +1,14 @@ +import { Xlsx } from "./fable/Xlsx.js" + +export const inputPath = "../TestWorkbook_Excel.xlsx"; + +export const outputPath = "../TestWorkbook_FsSpreadsheet.js.xlsx"; + +async function run() { + let wb = await Xlsx.fromXlsxFile(inputPath) + console.log(wb) + // await Xlsx.toFile(wb) +} + +run(); + diff --git a/tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.cmd b/tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.fsx.cmd similarity index 100% rename from tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.cmd rename to tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.fsx.cmd diff --git a/tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.js.cmd b/tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.js.cmd new file mode 100644 index 00000000..7d02c3cd --- /dev/null +++ b/tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.js.cmd @@ -0,0 +1,3 @@ +dotnet fable ../../../../src/FsSpreadsheet.Exceljs -o ./fable --noCache + +node ./fsSpreadsheet.js \ No newline at end of file diff --git a/tests/TestUtils/TestFiles/TestWorkbook_FableExceljs.xlsx b/tests/TestUtils/TestFiles/TestWorkbook_FableExceljs.xlsx index 4e3ba1ba4ed0e62ceedcd15c2dac844d17de531d..28fc364ec9e2d909eb3584f3ba98a149cb1fa3de 100644 GIT binary patch delta 419 zcmX>Vd@7hXz?+$ci-CcGgQ2q|WFzlVMrI&Ac`KtLh~9jYksl)Pnn?~U!NaTqmM~`4 zg-9f`Xo3a$Sy-9DDyFmRgXxp(@4*tgIc_q68PmDngBg=M`96RJYWPDTW?T_a1q=KU zcmWpJ{9NcGMCP^##5yL?y=-75hotXA3|S%vkvT256QZYGAsNDWtN0M2`J%ENNY7*; z6+s9o?^ad3ZF#TM`6-?`^T7v0pRcA20QPmzye^&Ja(=KWd@h&KRK@B3V zs18w=tZoWcHyg^o3#B)xNKdxXkOa$xX+YdGUBd#*2g$vK%5iF1gT>r6ZNPM!rV9YO CPLrGf delta 419 zcmX>Vd@7hXz?+$ci-CcGgTXo_cq8vpMrI&Ac`KtLh~9jYksl)Pnn?~U!NaTqmM~`4 zg-9f`Xo3a$Sy-9DDyFmRgXxp(@4*tgIc_q68PmDngBg=M`96RJYWPDTW?T_a1q=KU zcmWpJ{9NcGMCP^##5yL?y=-75hotXA3|S%vkvT256QZYGAsNDWtN0M2`J%ENNY7*; z6+s9o?^ad3ZF#TM`6-?`^T7v0pRcA20QPmzye^&Ja(=KWd@h&KRK@B3V zs18w=tZoWcHyg^o3#B)xNKdxXkOa$xX+YdGUBd#*2g$vK%5iF1gT>r6ZNPM!rV9XK C>w(Mw diff --git a/tests/TestUtils/TestFiles/TestWorkbook_FsSpreadsheet.xlsx b/tests/TestUtils/TestFiles/TestWorkbook_FsSpreadsheet.net.xlsx similarity index 55% rename from tests/TestUtils/TestFiles/TestWorkbook_FsSpreadsheet.xlsx rename to tests/TestUtils/TestFiles/TestWorkbook_FsSpreadsheet.net.xlsx index 5b04b791b642c92272d9fa30a65333459785a0f8..40c1cd02610284407a12a965a97488b784d0abf4 100644 GIT binary patch delta 1021 zcmX@Bd0w+Vz?+#xgn@yBgQ2%2BwXr;+_Jw63=IBE3=I50x*|uvJijPADL+43uOc^R z>!rPUhZO`E9)vr-;k9^hWaFchlascty0Y=mkB-0}8yU9O{RvuLy4Wvvlk9QMebzVR z)w3^Hx2)KkU9fSHMC0Urm)~7_V7PKQmpuRPmH$3Gyj4|S@4EBe(W&GDtL;$5;C7F*W7 z+r+sz;I)iR@XAw@F3Dz3eKgxl{I0=6dx`Z^rWJfD+VbF%ukeA6DboFW<&@l>=%+7} z==j*TInLrhq~h*rZ?!Dcb}o4Ha89aK{_;YDsIC(GdyoMyB4D%}ba(nLzY=7H=@$hK(1@_vY{c(=)mJ896{)zc{MZnG|G@9px8D`ab^F3& z$8+wQ#d!_4gss`^x3B&XI@^4t{qH-D#a%DmUbI^-_;RF8>bv2&Xs4!ki9w3R#y3im z=FAWAiM~HE^5y1N4I)#f9nr6suDI*6{5DU$rd2W+J=wQ4LCoVIURVhq=tRt zu_sn_=QmwB^kU`OkAYK{uHjNFJtvwk)hYPX{6hEV=NFidY<-zN=fr&PeGdY2TNZ3d z>NVVx^MJ47XcPOKr@L|^RA)Zx+GPD;Bdh-tX*HMAJ3}m&&wkbI9u{BmpAi(w9Izxg zIgjr(FmxwJ^Mk0(9s-_>;E)0*)XB31O+bPB*XY*a-NW~JSdD0Z)I`4$;iNPk(Gf#0+_@Rz;N;gA$5?3n?NHRIKV~}aIo?P z03%j}0q!DsVHw80$u`0e<3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