summaryrefslogtreecommitdiff
path: root/tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs')
-rw-r--r--tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs b/tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs
new file mode 100644
index 0000000..d961d8b
--- /dev/null
+++ b/tests/SomhairlesDream.Shared.Tests/FrontendContractTests.fs
@@ -0,0 +1,36 @@
+module SomhairlesDream.Shared.Tests.FrontendContractTests
+
+open System.IO
+open Xunit
+
+let private root = Path.GetFullPath(Path.Combine(__SOURCE_DIRECTORY__, "..", ".."))
+
+let private readRelative path = File.ReadAllText(Path.Combine(root, path))
+
+let private assertBrowserContract contents =
+ Assert.Contains("/api/runs/start", contents)
+ Assert.Contains("/api/runs/events?projectId=", contents)
+ Assert.Contains("artifact-manifest-link", contents)
+ Assert.DoesNotContain("/api/events", contents)
+
+[<Fact>]
+let ``frontend source and bundle use the selected artifact run lifecycle`` () =
+ readRelative "src/SomhairlesDream.Frontend/App.fs"
+ |> assertBrowserContract
+
+ readRelative "public/App.js"
+ |> assertBrowserContract
+
+ let html = readRelative "public/index.html"
+ Assert.Contains("id=\"run-start-button\"", html)
+ Assert.Contains("id=\"artifact-manifest-link\"", html)
+
+[<Fact>]
+let ``solution contains every project in the artifact pipeline`` () =
+ let solution = readRelative "SomhairlesDream.sln"
+
+ [ "SomhairlesDream.Modeling"
+ "SomhairlesDream.Cli"
+ "SomhairlesDream.Modeling.Tests"
+ "SomhairlesDream.Cli.Tests" ]
+ |> List.iter (fun project -> Assert.Contains(project, solution))