Test suite refactoring to match new htmx HTML swapping in pages

This commit is contained in:
Alphonse Paix
2025-09-17 14:16:27 +02:00
parent 7364e2a23c
commit bdddf0fe4a
8 changed files with 91 additions and 163 deletions

View File

@@ -1,8 +1,5 @@
use crate::helpers::TestApp;
use wiremock::{
Mock, ResponseTemplate,
matchers::{method, path},
};
use crate::helpers::{TestApp, when_sending_an_email};
use wiremock::ResponseTemplate;
#[tokio::test]
async fn confirmation_links_without_token_are_rejected_with_a_400() {
@@ -15,14 +12,13 @@ async fn confirmation_links_without_token_are_rejected_with_a_400() {
}
#[tokio::test]
async fn clicking_on_the_link_shows_a_confiramtion_message() {
async fn clicking_on_the_link_shows_a_confirmation_message() {
let app = TestApp::spawn().await;
let email = "alphonse.paix@outlook.com";
let body = format!("name=Alphonse&email={email}&email_check={email}");
let body = format!("email={email}");
Mock::given(path("v1/email"))
.and(method("POST"))
when_sending_an_email()
.respond_with(ResponseTemplate::new(200))
.expect(1)
.mount(&app.email_server)
@@ -39,7 +35,7 @@ async fn clicking_on_the_link_shows_a_confiramtion_message() {
.text()
.await
.unwrap()
.contains("Your account has been confirmed")
.contains("Subscription confirmed")
);
}
@@ -50,8 +46,7 @@ async fn clicking_on_the_confirmation_link_confirms_a_subscriber() {
let email = "alphonse.paix@outlook.com";
let body = format!("email={email}");
Mock::given(path("v1/email"))
.and(method("POST"))
when_sending_an_email()
.respond_with(ResponseTemplate::new(200))
.expect(1)
.mount(&app.email_server)