test(axum): prove page response semantics
Close the first hemx-axum mutation class by proving page-mode detection and response constructor fingerprint behavior through the public integration API. req: page_swap/001 req: abi/005
This commit is contained in:
@@ -118,6 +118,14 @@ fn page_mode_detects_partial_header() {
|
||||
#[test]
|
||||
fn page_request_wraps_full_pages_and_leaves_partials_unwrapped() {
|
||||
// req: test/005
|
||||
assert!(!PageRequest {
|
||||
mode: PageMode::Full
|
||||
}
|
||||
.is_partial());
|
||||
assert!(PageRequest {
|
||||
mode: PageMode::Partial
|
||||
}
|
||||
.is_partial());
|
||||
let full = PageRequest {
|
||||
mode: PageMode::Full,
|
||||
}
|
||||
@@ -209,6 +217,26 @@ fn page_request_wraps_safe_html_full_pages_and_leaves_partials_unwrapped() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn page_response_constructors_preserve_mode_and_optional_fingerprint() {
|
||||
let full = PageResponse::full("<html>Full</html>");
|
||||
assert_eq!(full.mode, PageMode::Full);
|
||||
assert_eq!(full.html, "<html>Full</html>");
|
||||
assert_eq!(full.fingerprint, None);
|
||||
|
||||
let partial = PageResponse::partial("<main>Partial</main>");
|
||||
assert_eq!(partial.mode, PageMode::Partial);
|
||||
assert_eq!(partial.html, "<main>Partial</main>");
|
||||
assert_eq!(partial.fingerprint, None);
|
||||
|
||||
let fingerprint = BuildFingerprint(42);
|
||||
assert_eq!(
|
||||
partial.fingerprint(fingerprint).fingerprint,
|
||||
Some(fingerprint)
|
||||
);
|
||||
// test req: page_swap/001 req: abi/005
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_page_response_sets_partial_and_title_headers() {
|
||||
let response = PageResponse::partial("<main>Docs</main>")
|
||||
|
||||
Reference in New Issue
Block a user