✅ Mueve a tests/ pruebas públicas

Las pruebas de los ajustes que sólo usan la API pública pasan de
global.rs y del config.rs de pagetop-cron a `tests/`. En el código sólo
quedan las que prueban algo privado y la de reference.toml.
This commit is contained in:
Manuel Cillero 2026-11-07 16:57:57 +01:00
parent a0416e5670
commit d074f252a7
4 changed files with 114 additions and 109 deletions

View file

@ -119,22 +119,4 @@ mod tests {
fn reference_toml_documents_only_existing_keys() {
config::load_from_str::<CronSettings>(REFERENCE).unwrap();
}
// Job keys usually contain dots, which TOML only accepts quoted. They must reach the map as a
// single key, not as nested tables.
#[test]
fn quoted_job_keys_with_dots_are_kept_whole() {
let settings = config::load_from_str::<CronSettings>(
r#"
[cron.jobs."shop.cleanup"]
enabled = false
schedule = "@hourly"
"#,
)
.unwrap();
let job = &settings.jobs["shop.cleanup"];
assert!(!job.enabled);
assert_eq!(job.schedule.as_deref(), Some("@hourly"));
assert_eq!(job.timeout_secs, None);
}
}

View file

@ -0,0 +1,20 @@
use pagetop::prelude::*;
use pagetop_cron::config::CronSettings;
// Job keys usually contain dots, which TOML only accepts quoted. They must reach the map as a
// single key, not as nested tables.
#[pagetop::test]
async fn quoted_job_keys_with_dots_are_kept_whole() {
let settings = config::load_from_str::<CronSettings>(
r#"
[cron.jobs."shop.cleanup"]
enabled = false
schedule = "@hourly"
"#,
)
.unwrap();
let job = &settings.jobs["shop.cleanup"];
assert!(!job.enabled);
assert_eq!(job.schedule.as_deref(), Some("@hourly"));
assert_eq!(job.timeout_secs, None);
}