Added tests for as-of date logic
This commit is contained in:
parent
0cd60b34ca
commit
9c40af0765
@ -482,7 +482,7 @@ let requestListTests =
|
|||||||
}
|
}
|
||||||
|> f
|
|> f
|
||||||
yield! testFixture withRequestList [
|
yield! testFixture withRequestList [
|
||||||
"asHtml succeeds without header",
|
"asHtml succeeds without header or as-of date",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let htmlList = { reqList with listGroup = { reqList.listGroup with name = "Test HTML Group" } }
|
let htmlList = { reqList with listGroup = { reqList.listGroup with name = "Test HTML Group" } }
|
||||||
let html = htmlList.asHtml _s
|
let html = htmlList.asHtml _s
|
||||||
@ -538,7 +538,37 @@ let requestListTests =
|
|||||||
Expect.stringContains html lstHeading "Expected HTML for the list heading not found"
|
Expect.stringContains html lstHeading "Expected HTML for the list heading not found"
|
||||||
// spot check; without header test tests this exhaustively
|
// spot check; without header test tests this exhaustively
|
||||||
Expect.stringContains html "<strong>Zeb</strong> — zyx</li>" "Expected requests not found"
|
Expect.stringContains html "<strong>Zeb</strong> — zyx</li>" "Expected requests not found"
|
||||||
"asText succeeds",
|
"asHtml succeeds with short as-of date",
|
||||||
|
fun reqList ->
|
||||||
|
let htmlList =
|
||||||
|
{ reqList with
|
||||||
|
listGroup =
|
||||||
|
{ reqList.listGroup with
|
||||||
|
preferences = { reqList.listGroup.preferences with asOfDateDisplay = ShortDate }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let html = htmlList.asHtml _s
|
||||||
|
let expected =
|
||||||
|
htmlList.requests.[0].updatedDate.ToShortDateString ()
|
||||||
|
|> sprintf "<strong>Zeb</strong> — zyx<i style=\"font-size:9.60pt\"> (as of %s)</i>"
|
||||||
|
// spot check; if one request has it, they all should
|
||||||
|
Expect.stringContains html expected "Expected short as-of date not found"
|
||||||
|
"asHtml succeeds with long as-of date",
|
||||||
|
fun reqList ->
|
||||||
|
let htmlList =
|
||||||
|
{ reqList with
|
||||||
|
listGroup =
|
||||||
|
{ reqList.listGroup with
|
||||||
|
preferences = { reqList.listGroup.preferences with asOfDateDisplay = LongDate }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let html = htmlList.asHtml _s
|
||||||
|
let expected =
|
||||||
|
htmlList.requests.[0].updatedDate.ToLongDateString ()
|
||||||
|
|> sprintf "<strong>Zeb</strong> — zyx<i style=\"font-size:9.60pt\"> (as of %s)</i>"
|
||||||
|
// spot check; if one request has it, they all should
|
||||||
|
Expect.stringContains html expected "Expected long as-of date not found"
|
||||||
|
"asText succeeds with no as-of date",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let textList = { reqList with listGroup = { reqList.listGroup with name = "Test Group" } }
|
let textList = { reqList with listGroup = { reqList.listGroup with name = "Test Group" } }
|
||||||
let text = textList.asText _s
|
let text = textList.asText _s
|
||||||
@ -552,6 +582,36 @@ let requestListTests =
|
|||||||
Expect.stringContains text "------------------\n PRAISE REPORTS\n------------------\n"
|
Expect.stringContains text "------------------\n PRAISE REPORTS\n------------------\n"
|
||||||
"Heading for category \"Praise Reports\" not found"
|
"Heading for category \"Praise Reports\" not found"
|
||||||
Expect.stringContains text " + nmo\n \n" "Last request not found"
|
Expect.stringContains text " + nmo\n \n" "Last request not found"
|
||||||
|
"asText succeeds with short as-of date",
|
||||||
|
fun reqList ->
|
||||||
|
let textList =
|
||||||
|
{ reqList with
|
||||||
|
listGroup =
|
||||||
|
{ reqList.listGroup with
|
||||||
|
preferences = { reqList.listGroup.preferences with asOfDateDisplay = ShortDate }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let text = textList.asText _s
|
||||||
|
let expected =
|
||||||
|
textList.requests.[0].updatedDate.ToShortDateString ()
|
||||||
|
|> sprintf " + Zeb - zyx (as of %s)"
|
||||||
|
// spot check; if one request has it, they all should
|
||||||
|
Expect.stringContains text expected "Expected short as-of date not found"
|
||||||
|
"asText succeeds with long as-of date",
|
||||||
|
fun reqList ->
|
||||||
|
let textList =
|
||||||
|
{ reqList with
|
||||||
|
listGroup =
|
||||||
|
{ reqList.listGroup with
|
||||||
|
preferences = { reqList.listGroup.preferences with asOfDateDisplay = LongDate }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let text = textList.asText _s
|
||||||
|
let expected =
|
||||||
|
textList.requests.[0].updatedDate.ToLongDateString ()
|
||||||
|
|> sprintf " + Zeb - zyx (as of %s)"
|
||||||
|
// spot check; if one request has it, they all should
|
||||||
|
Expect.stringContains text expected "Expected long as-of date not found"
|
||||||
"isNew succeeds for both old and new requests",
|
"isNew succeeds for both old and new requests",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let reqs = reqList.requestsInCategory CurrentRequest
|
let reqs = reqList.requestsInCategory CurrentRequest
|
||||||
|
@ -636,7 +636,7 @@ with
|
|||||||
| ShortDate -> req.updatedDate.ToShortDateString ()
|
| ShortDate -> req.updatedDate.ToShortDateString ()
|
||||||
| LongDate -> req.updatedDate.ToLongDateString ()
|
| LongDate -> req.updatedDate.ToLongDateString ()
|
||||||
| _ -> ""
|
| _ -> ""
|
||||||
yield i [ _style (sprintf "font-size:%fpt" asOfSize) ] [
|
yield i [ _style (sprintf "font-size:%.2fpt" asOfSize) ] [
|
||||||
rawText " ("; str s.["as of"].Value; str " "; str dt; rawText ")"
|
rawText " ("; str s.["as of"].Value; str " "; str dt; rawText ")"
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user