✅ (tests): Adapta la suite al nuevo framework web
- Sustituye `service::test::*` por `web::test::*` (migración de actix-web a
axum).
- Extrae `setup()` en los módulos que sólo renderizan componentes,
evitando levantar un router completo en cada test.
- Elimina los `env::set_var("PAGETOP_RUN_MODE", "test")` manuales, ya
cubiertos por la *feature* `testing`.
This commit is contained in:
parent
87e4eac27c
commit
eb18690a5c
6 changed files with 45 additions and 53 deletions
|
|
@ -2,7 +2,7 @@ use pagetop::prelude::*;
|
|||
|
||||
#[pagetop::test]
|
||||
async fn literal_text() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::n("© 2025 PageTop");
|
||||
assert_eq!(l10n.get(), Some("© 2025 PageTop".to_string()));
|
||||
|
|
@ -10,7 +10,7 @@ async fn literal_text() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn translation_without_args() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::l("test_hello_world");
|
||||
let translation = l10n.lookup(&Locale::resolve("es-ES"));
|
||||
|
|
@ -19,7 +19,7 @@ async fn translation_without_args() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn translation_with_args() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::l("test_hello_user").with_arg("userName", "Manuel");
|
||||
let translation = l10n.lookup(&Locale::resolve("es-ES"));
|
||||
|
|
@ -28,7 +28,7 @@ async fn translation_with_args() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn translation_with_plural_and_select() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::l("test_shared_photos").with_args(vec![
|
||||
("userName", "Roberto"),
|
||||
|
|
@ -41,7 +41,7 @@ async fn translation_with_plural_and_select() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn check_fallback_language() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::l("test_hello_world");
|
||||
let translation = l10n.lookup(&Locale::resolve("xx-YY")); // Retrocede a "en-US".
|
||||
|
|
@ -50,7 +50,7 @@ async fn check_fallback_language() {
|
|||
|
||||
#[pagetop::test]
|
||||
async fn check_unknown_key() {
|
||||
let _app = service::test::init_service(Application::new().test()).await;
|
||||
let _app = web::test::init_router(Application::new().test());
|
||||
|
||||
let l10n = L10n::l("non-existent-key");
|
||||
let translation = l10n.lookup(&Locale::resolve("en-US"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue