Version 2.1 #41

Merged
danieljsummers merged 123 commits from version-2.1 into main 2024-03-27 00:13:28 +00:00
Showing only changes of commit 8ec7610ee3 - Show all commits

View File

@ -434,33 +434,33 @@ let webLogTests =
} }
test "succeeds for single subdirectory" { test "succeeds for single subdirectory" {
Expect.equal Expect.equal
{ WebLog.Empty with UrlBase = "http://a.com/subdir" }.ExtraPath { WebLog.Empty with UrlBase = "https://a.com/sub" }.ExtraPath
"/subdir" "/sub"
"Extra path incorrect for a single subdirectory" "Extra path incorrect for a single subdirectory"
} }
test "succeeds for deeper nesting" { test "succeeds for deeper nesting" {
Expect.equal Expect.equal
{ WebLog.Empty with UrlBase = "http://b.com/users/test/units" }.ExtraPath { WebLog.Empty with UrlBase = "https://b.com/users/test/units" }.ExtraPath
"/users/test/units" "/users/test/units"
"Extra path incorrect for deeper nesting" "Extra path incorrect for deeper nesting"
} }
] ]
test "AbsoluteUrl succeeds" { test "AbsoluteUrl succeeds" {
Expect.equal Expect.equal
({ WebLog.Empty with UrlBase = "http://my.site" }.AbsoluteUrl(Permalink "blog/page.html")) ({ WebLog.Empty with UrlBase = "https://my.site" }.AbsoluteUrl(Permalink "blog/page.html"))
"http://my.site/blog/page.html" "https://my.site/blog/page.html"
"Absolute URL is incorrect" "Absolute URL is incorrect"
} }
testList "RelativeUrl" [ testList "RelativeUrl" [
test "succeeds for domain root URL" { test "succeeds for domain root URL" {
Expect.equal Expect.equal
({ WebLog.Empty with UrlBase = "http://test.me" }.RelativeUrl(Permalink "about.htm")) ({ WebLog.Empty with UrlBase = "https://test.me" }.RelativeUrl(Permalink "about.htm"))
"/about.htm" "/about.htm"
"Relative URL is incorrect for domain root site" "Relative URL is incorrect for domain root site"
} }
test "succeeds for domain non-root URL" { test "succeeds for domain non-root URL" {
Expect.equal Expect.equal
({ WebLog.Empty with UrlBase = "http://site.page/a/b/c" }.RelativeUrl(Permalink "x/y/z")) ({ WebLog.Empty with UrlBase = "https://site.page/a/b/c" }.RelativeUrl(Permalink "x/y/z"))
"/a/b/c/x/y/z" "/a/b/c/x/y/z"
"Relative URL is incorrect for domain non-root site" "Relative URL is incorrect for domain non-root site"
} }
@ -672,15 +672,15 @@ let displayThemeTests =
Expect.isFalse model.IsOnDisk "IsOnDisk should not have been set" Expect.isFalse model.IsOnDisk "IsOnDisk should not have been set"
} }
test "succeeds when the theme is not in use as is on disk" { test "succeeds when the theme is not in use as is on disk" {
let file = File.Create "the-theme-theme.zip" let file = File.Create "another-theme.zip"
try try
let model = DisplayTheme.FromTheme (fun _ -> false) theme let model = DisplayTheme.FromTheme (fun _ -> false) { theme with Id = ThemeId "another" }
Expect.isFalse model.IsInUse "IsInUse should not have been set" Expect.isFalse model.IsInUse "IsInUse should not have been set"
Expect.isTrue model.IsOnDisk "IsOnDisk should have been set" Expect.isTrue model.IsOnDisk "IsOnDisk should have been set"
finally finally
file.Close() file.Close()
file.Dispose() file.Dispose()
File.Delete "the-theme-theme.zip" File.Delete "another-theme.zip"
} }
] ]