Cotton code
24 lines · 1.0 KB · RustRaw
use cotton_store::{migrate::migrate_store, Driver};// RULE: The disposable baseline contains only current memory states.// Proposed rows belong to the approved final move, never to a development database.#[test]fn memory_schema_refuses_the_retired_proposed_status() {    let db = Driver::open_in_memory().unwrap();    migrate_store(&db).unwrap();    db.exec("INSERT INTO cotton_workspaces (id, name, owner_user_id, created_at) VALUES ('w', 'Synthetic', 'owner', '2026-10-03')").unwrap();    let insert = |status: &str| {        format!(        "INSERT INTO cotton_memories (id, workspace_id, slug, title, status, origin_kind, created_at, updated_at) VALUES ('m', 'w', 'synthetic', 'Synthetic sentence', '{status}', 'user', '2026-10-03', '2026-10-03')"    )    };    assert!(db.exec(&insert("proposed")).is_err());    db.exec(&insert("active")).unwrap();    assert!(db        .get(            "SELECT name FROM sqlite_master WHERE name = 'idx_cotton_memories_proposed'",            &[]        )        .unwrap()        .is_none());}