forked from yvv/decision
WIP lot S : floor_amend retiré (le quorum le remplace), fixture de production sous tests/fixtures/seed-production-2026-11-02/, reprise des tests (api, inertia, ballots, objections, typos)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,15 +9,25 @@ use ld_server::{AppState, CSRF_HEADER, CSRF_VALUE, Config, adoption, app, deadli
|
||||
use serde_json::{Value, json};
|
||||
use tower::ServiceExt;
|
||||
|
||||
/// The seed of production before its seed proposal amendment (ADR 0011): texts in force.
|
||||
fn production() -> Config {
|
||||
let mut cfg = Config::for_tests();
|
||||
cfg.seed_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/seed-production-2026-11-02");
|
||||
cfg
|
||||
}
|
||||
|
||||
struct Client {
|
||||
router: axum::Router,
|
||||
cookie: Option<String>,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
/// A base seeded as production is before its seed proposal amendment (ADR 0011):
|
||||
/// I1, E1 and E2 in force, seeds a minima — as they stay wherever it is refused.
|
||||
/// These scenarios need texts in force; the seed of today has none.
|
||||
async fn new() -> (Self, AppState) {
|
||||
let db = open_db("sqlite::memory:").await.expect("db");
|
||||
let state = AppState::new(Config::for_tests(), db).await.expect("state");
|
||||
let state = AppState::new(production(), db).await.expect("state");
|
||||
seed::ensure(&state).await.expect("seed");
|
||||
(Self { router: app(state.clone()), cookie: None }, state)
|
||||
}
|
||||
@@ -670,7 +680,7 @@ async fn the_same_objection_sent_at_once_stands_once() {
|
||||
let path = std::env::temp_dir().join(format!("ld-lot-f-twice-{}.db", std::process::id()));
|
||||
let _ = std::fs::remove_file(&path);
|
||||
let db = open_db(&format!("sqlite://{}", path.display())).await.expect("db");
|
||||
let state = AppState::new(Config::for_tests(), db).await.expect("state");
|
||||
let state = AppState::new(production(), db).await.expect("state");
|
||||
seed::ensure(&state).await.expect("seed");
|
||||
let mut chiara = Client { router: app(state.clone()), cookie: None };
|
||||
chiara.login("Chiara", false).await;
|
||||
@@ -719,7 +729,7 @@ async fn a_deadline_passed_while_stopped_is_taken_at_start() {
|
||||
let url = format!("sqlite://{}", path.display());
|
||||
let (b, oid) = {
|
||||
let db = open_db(&url).await.expect("db");
|
||||
let state = AppState::new(Config::for_tests(), db).await.expect("state");
|
||||
let state = AppState::new(production(), db).await.expect("state");
|
||||
seed::ensure(&state).await.expect("seed");
|
||||
let mut chiara = Client { router: app(state.clone()), cookie: None };
|
||||
chiara.login("Chiara", false).await;
|
||||
@@ -776,7 +786,7 @@ async fn contradiction_signals_of_before_become_contredits() {
|
||||
let mut before = sqlx::migrate!("./migrations");
|
||||
before.migrations = before.migrations.iter().filter(|m| m.version < 8).cloned().collect::<Vec<_>>().into();
|
||||
before.run(&pool).await.expect("up to 0007");
|
||||
let state = AppState::new(Config::for_tests(), pool.clone()).await.expect("state");
|
||||
let state = AppState::new(production(), pool.clone()).await.expect("state");
|
||||
// The documents as the image of before wrote them (its amendments read tables of now).
|
||||
seed::documents(&state).await.expect("seed");
|
||||
let id = |code: &'static str, which: &'static str| {
|
||||
|
||||
Reference in New Issue
Block a user