Version 2.1 #41

Merged
danieljsummers merged 123 commits from version-2.1 into main 2024-03-27 00:13:28 +00:00
4 changed files with 19 additions and 1 deletions
Showing only changes of commit f701fc9c93 - Show all commits

View File

@ -54,7 +54,7 @@ type IPageData =
/// Add a page /// Add a page
abstract member Add : Page -> Task<unit> abstract member Add : Page -> Task<unit>
/// Get all pages for the web log (excluding meta items, text, revisions, and prior permalinks) /// Get all pages for the web log (excluding revisions)
abstract member All : WebLogId -> Task<Page list> abstract member All : WebLogId -> Task<Page list>
/// Count all pages for the given web log /// Count all pages for the given web log

View File

@ -5,6 +5,9 @@ open MyWebLog
open MyWebLog.Data open MyWebLog.Data
open NodaTime open NodaTime
/// The ID of the root web log
let rootId = WebLogId "uSitJEuD3UyzWC9jgOHc8g"
let ``Add succeeds`` (data: IData) = task { let ``Add succeeds`` (data: IData) = task {
let page = let page =
{ Id = PageId "added-page" { Id = PageId "added-page"
@ -43,3 +46,10 @@ let ``Add succeeds`` (data: IData) = task {
Expect.equal pg.Revisions[0].AsOf page.Revisions[0].AsOf "Revision as of not saved properly" Expect.equal pg.Revisions[0].AsOf page.Revisions[0].AsOf "Revision as of not saved properly"
Expect.equal pg.Revisions[0].Text page.Revisions[0].Text "Revision text not saved properly" Expect.equal pg.Revisions[0].Text page.Revisions[0].Text "Revision text not saved properly"
} }
let ``All succeeds`` (data: IData) = task {
let! pages = data.Page.All rootId
Expect.hasLength pages 2 "There should have been 4 pages retrieved"
Expect.isEmpty pages[0].Revisions "Page 0 should have had no revisions"
Expect.isEmpty pages[1].Revisions "Page 1 should have had no revisions"
}

View File

@ -105,6 +105,9 @@ let pageTests = testList "Page" [
testTask "Add succeeds" { testTask "Add succeeds" {
do! PageDataTests.``Add succeeds`` (mkData ()) do! PageDataTests.``Add succeeds`` (mkData ())
} }
testTask "All succeeds" {
do! PageDataTests.``All succeeds`` (mkData ())
}
] ]
/// Drop the throwaway PostgreSQL database /// Drop the throwaway PostgreSQL database

View File

@ -148,6 +148,11 @@ let pageTests = testList "Page" [
try do! PageDataTests.``Add succeeds`` data try do! PageDataTests.``Add succeeds`` data
finally dispose data finally dispose data
} }
testTask "All succeeds" {
let data = mkData ()
try do! PageDataTests.``All succeeds`` data
finally dispose data
}
] ]
/// Delete the SQLite database /// Delete the SQLite database