From 6f2e4dd8e16b57bc1c7cd871e674e2f98b3ff612 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Thu, 7 Nov 2024 15:45:15 +0100 Subject: [PATCH] reenable office test suit --- build/Build.fs | 7 +++++-- src/Client/MainComponents/Cells.fs | 1 - tests/Client/Client.Tests.fs | 2 +- tests/Client/OfficeAddin.Tests.fs | 22 ++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/Build.fs b/build/Build.fs index 429c9045..b6e1b455 100644 --- a/build/Build.fs +++ b/build/Build.fs @@ -347,13 +347,15 @@ Target.create "RunDB" (fun _ -> module Tests = let buildSharedTests () = run dotnet [ "build" ] sharedTestsPath + /// This disables microsoft data collection for using `office-addin-mock` + let disableUserData() = run npx [ "office-addin-usage-data"; "off" ] __SOURCE_DIRECTORY__ let Watch() = [ "server", dotnet [ "watch"; "run" ] serverTestsPath // This below will start web ui for tests, but cannot execute due to office-addin-mock - "client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "vite" ] clientTestsPath - // "client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "mocha"; $"{clientTestsPath}/output/Client.Tests.js" ] clientTestsPath + //"client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "vite" ] clientTestsPath + "client", dotnet [ "fable"; "watch"; "-o"; "output"; "-s"; "--run"; "npx"; "mocha"; $"{clientTestsPath}/output/Client.Tests.js" ] clientTestsPath ] |> runParallel @@ -387,6 +389,7 @@ let main args = | _ -> Run(false); 0 | "test" :: a -> Tests.buildSharedTests() + Tests.disableUserData() match a with | "watch" :: _ -> Tests.Watch(); 0 | _ -> Tests.Run(); 0 diff --git a/src/Client/MainComponents/Cells.fs b/src/Client/MainComponents/Cells.fs index 8c144cb7..2cc70e9d 100644 --- a/src/Client/MainComponents/Cells.fs +++ b/src/Client/MainComponents/Cells.fs @@ -36,7 +36,6 @@ module private CellComponents = prop.children [Html.i [prop.classes ["fa-sharp"; "fa-solid"; "fa-angles-up"; if isExtended then "fa-rotate-270" else "fa-rotate-90"]; prop.style [style.fontSize(length.em 1)]]] ] - module private CellAux = let headerTSRSetter (columnIndex: int, s: string, header: CompositeHeader, dispatch) = diff --git a/tests/Client/Client.Tests.fs b/tests/Client/Client.Tests.fs index d5bc92d4..86b3b6dc 100644 --- a/tests/Client/Client.Tests.fs +++ b/tests/Client/Client.Tests.fs @@ -16,7 +16,7 @@ let all = #if FABLE_COMPILER // This preprocessor directive makes editor happy Shared.Tests.shared #endif - // OfficeAddin.Tests.Main + OfficeAddin.Tests.Main client ] diff --git a/tests/Client/OfficeAddin.Tests.fs b/tests/Client/OfficeAddin.Tests.fs index 2cc42633..58b3b4fd 100644 --- a/tests/Client/OfficeAddin.Tests.fs +++ b/tests/Client/OfficeAddin.Tests.fs @@ -8,16 +8,14 @@ open ExcelJS.Fable.Excel // ⚠️ These tests do only work on node.js as the office-addin-mock library sents user data to microsoft !!! ⚠️ // Check out https://github.com/OfficeDev/Office-Addin-Scripts/issues/905 -// let private TestsBasic = testList "Basic tests" [ -// testCaseAsync "develop mock" <| async { -// let testContext: RequestContext = importDefault "./OfficeMockObjects/ExampleObject.js" -// let! result = OfficeInterop.ExcelUtil.getSelectedRangeAdress testContext |> Async.AwaitPromise -// Expect.equal result "C2:G3" "Verify correct setup" -// } -// ] +let private TestsBasic = testList "Basic tests" [ + testCaseAsync "develop mock" <| async { + let testContext: RequestContext = importDefault "./OfficeMockObjects/ExampleObject.js" + let! result = OfficeInterop.ExcelUtil.getSelectedRangeAdress testContext |> Async.AwaitPromise + Expect.equal result "C2:G3" "Verify correct setup" + } +] -// let Main = testList "OfficeAddin" [ -// TestsBasic -// ] - -let x = 0 \ No newline at end of file +let Main = testList "OfficeAddin" [ + TestsBasic +] \ No newline at end of file