Skip to content

Commit

Permalink
Setup current FsSpreadsheet.Exceljs write for defaultio tests 🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Oct 20, 2023
1 parent 05e0ca4 commit 9805811
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/FsSpreadsheet.Exceljs/Worksheet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/FsSpreadsheet.ExcelIO.Tests/DefaultIO.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand Down
2 changes: 1 addition & 1 deletion tests/FsSpreadsheet.Exceljs.Tests/DefaultIO.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
6 changes: 4 additions & 2 deletions tests/TestUtils/DefaultTestObjects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ type TestFiles =
| Libre
| FableExceljs
| ClosedXML
| FsSpreadsheet
| FsSpreadsheetNET
| FsSpreadsheetJS

member this.asFileName =
match this with
| Excel -> "TestWorkbook_Excel.xlsx"
| 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}"
Expand Down
2 changes: 1 addition & 1 deletion tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 14 additions & 0 deletions tests/TestUtils/TestFiles/Scripts/fsSpreadsheet.js
Original file line number Diff line number Diff line change
@@ -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();

3 changes: 3 additions & 0 deletions tests/TestUtils/TestFiles/Scripts/runFsSpreadsheet.js.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dotnet fable ../../../../src/FsSpreadsheet.Exceljs -o ./fable --noCache

node ./fsSpreadsheet.js
Binary file modified tests/TestUtils/TestFiles/TestWorkbook_FableExceljs.xlsx
Binary file not shown.
Binary file not shown.

0 comments on commit 9805811

Please sign in to comment.