zero-to-production
zero-to-production copied to clipboard
10.6.4.13 assert only successful because of spelling error
The third act of the test 'an_error_flash_message_is_set_on_failure()'
let html_page = app.get_login_html().await;
assert!(!html_page.contains(r#"<p><i>Authentication failed</i></p>"#));
only succeeds because there is a period missing after failed.
If we replace the last part with
assert!(html_page.contains(r#"<p><i>Authentication failed.</i></p>"#));
it passes, and it becomes evident that "
Authentication failed.
" is contained in the HTML. Why his test passes is a mystery to me, since there is no message shown in the browser when reloading manually. It could be because the browser is refreshed before the cookie is dropped in the test, despite it having a lifetime of zero, but that's just my uneducated guess. Repo with my code up to this point: https://github.com/FandangoMango/zero2prod
I have tried to reproduce the issue, but I wasn't able to - the test keeps passing on all branches of this repository, even after making sure that there is no trailing dot 🤔