//! `export.build`, against a seeded synthetic replica. //! //! EVERY FIXTURE IS SYNTHETIC — no real name, number or sentence anywhere in //! this tree ([nothing-real-ever-goes-in-cotton-s-public-tree]). The rows here //! are the ones the export has opinions about: a dropped todo and an archived //! note that must stay out, a project journal page that must land in its own //! key, a person with half a birthday, a statement line a transaction cites and //! one nobody does, an event outside the window and a repeating one inside it, //! and a document with a password on it. //! //! The clock is the CONTROLLER's seam, fixed at `2026-09-08T10:00:00Z` //! (`FixedClock::default_start`), so the window, the stamp and the file name //! are assertable rather than a time bomb with a computable detonation date. use std::sync::Arc; use cotton_client::layout::Layout; use cotton_client::seams::{FixedClock, SeededRandom}; use cotton_store::driver::{Driver, Row}; use rusqlite::types::Value as SqlValue; use serde_json::{json, Value}; use crate::events::EventBus; use crate::fixture; use crate::shell::client::ClientController; use super::{ birthday, document, export_file_name, record_count, write_document, EXPORT_FORMAT, EXPORT_MEDIA_LIMIT, EXPORT_VERSION, }; /// The instant the controller's clock is fixed at. const NOW: &str = "2026-09-08T10:00:00.000Z"; const NOW_MS: i64 = 1_788_861_600_000; /// The zone this synthetic phone is standing in. The events expansion prefers /// the WORKSPACE's and falls back to this, which is `expansionZone()`'s order. const ZONE: &str = "Asia/Kolkata"; fn text(value: &str) -> SqlValue { SqlValue::Text(value.to_string()) } /// A replica with the fixture's synthetic life in it, plus whatever the test /// adds, behind a controller whose clock does not move. /// /// The seeding driver is DROPPED before the controller opens the file: one /// file, one connection, one writer is the store's discipline. fn workspace(seed: impl FnOnce(&Driver)) -> (tempfile::TempDir, Arc) { let dir = tempfile::tempdir().expect("a data directory"); let layout = Layout::new(dir.path()); std::fs::create_dir_all(layout.client_dir()).expect("the client folder"); let path = layout.replica(fixture::WORKSPACE); std::fs::create_dir_all(path.parent().expect("the replica has a folder")) .expect("the replica folder"); { let db = fixture::seeded(&path); seed(&db); } std::fs::write( layout.connection_json(), serde_json::to_vec_pretty(&json!({ "mode": "remote", "baseUrl": "https://api.cottondb.example.invalid", "workspaceId": fixture::WORKSPACE, "ownerId": fixture::OWNER, "connectedAt": "2026-09-08T09:00:00.000Z", })) .expect("json"), ) .expect("the connection record"); let events = Arc::new(EventBus::new()); // A machine to read, on every build: the sources it names are only // registered where the host feature compiles them, and the fixture is // the same shape either way. let controller = ClientController::new( layout, events, Some(ZONE.to_string()), Some(crate::shell::client::MachineSources { device: "A synthetic machine".to_string(), home: dir.path().to_path_buf(), }), ); let controller = Arc::new(controller.with_seams( Arc::new(FixedClock::default_start()), Arc::new(SeededRandom::default()), )); (dir, controller) } /// The document, exactly as `build` assembles it. fn export_of(client: &ClientController) -> Value { client .with_writer(|replica| document(replica, NOW_MS, NOW, Some(ZONE))) .expect("the export is assembled") } fn ids(document: &Value, key: &str) -> Vec { document[key] .as_array() .unwrap_or_else(|| panic!("{key} is a list")) .iter() .map(|row| row["id"].as_str().expect("an id").to_string()) .collect() } // ── the seeders ─────────────────────────────────────────────────────────── fn a_calendar(db: &Driver) { db.run( "INSERT INTO cotton_collections (id, workspace_id, kind, name, created_at) \ VALUES (?,?,'calendar',?,?)", &[ text("calendar-a"), text(fixture::WORKSPACE), text("A synthetic calendar"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a calendar"); db.run( "INSERT INTO cotton_collections (id, workspace_id, kind, name, archived_at, created_at) \ VALUES (?,?,'calendar',?,?,?)", &[ text("calendar-archived"), text(fixture::WORKSPACE), text("A synthetic retired calendar"), text("2026-09-02T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("an archived calendar"); } fn an_event(db: &Driver, id: &str, starts_at: &str, rrule: Option<&str>) { db.run( "INSERT INTO cotton_events (id, collection_id, title, starts_at, rrule, created_at, \ updated_at) VALUES (?,?,?,?,?,?,?)", &[ text(id), text("calendar-a"), text("A synthetic appointment"), text(starts_at), rrule.map_or(SqlValue::Null, text), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("an event"); } fn a_statement_with_two_lines(db: &Driver) { db.run( "INSERT INTO cotton_documents (id, workspace_id, title, original_name, mime, byte_size, \ sha256, storage_path, password, status_changed_at, created_at, updated_at) \ VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", &[ text("document-a"), text(fixture::WORKSPACE), text("A synthetic statement"), text("synthetic.pdf"), text("application/pdf"), SqlValue::Integer(2048), text(&"a".repeat(64)), text("workspaces/synthetic/documents/synthetic.pdf"), text("an-alpaca-password"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a document"); db.run( "INSERT INTO cotton_money_statements (id, workspace_id, document_id, kind, currency, \ period_start, created_at, updated_at) VALUES (?,?,?,'bank','INR',?,?,?)", &[ text("statement-a"), text(fixture::WORKSPACE), text("document-a"), text("2026-08-01"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a statement"); for (id, line_no, ignored) in [("line-booked", 1, None), ("line-ignored", 2, Some("noise"))] { db.run( "INSERT INTO cotton_money_statement_lines (id, workspace_id, statement_id, page, \ line_no, posted_on, text, amount_minor, direction, fingerprint, ignored_reason, \ created_at) VALUES (?,?,?,1,?,?,?,?,'out',?,?,?)", &[ text(id), text(fixture::WORKSPACE), text("statement-a"), SqlValue::Integer(line_no), text("2026-08-15"), text("A synthetic line"), SqlValue::Integer(12_300), text(&format!("fp-{id}")), ignored.map_or(SqlValue::Null, text), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a statement line"); } db.run( "INSERT INTO cotton_money_transactions (id, workspace_id, occurred_on, description, \ created_at, updated_at) VALUES (?,?,?,?,?,?)", &[ text("transaction-a"), text(fixture::WORKSPACE), text("2026-08-15"), text("A synthetic entry"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a transaction"); db.run( "INSERT INTO cotton_money_evidence (id, workspace_id, transaction_id, kind, ref_id, \ excerpt, attached_by, created_at) \ VALUES (?,?,?,'statement_line',?,?,'owner',?)", &[ text("evidence-a"), text(fixture::WORKSPACE), text("transaction-a"), text("line-booked"), text("A synthetic excerpt"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("the evidence"); } // ── the document's own header ───────────────────────────────────────────── #[test] fn the_document_names_its_format_its_version_and_the_window_it_read() { let (_dir, client) = workspace(|_| {}); let document = export_of(&client); assert_eq!(document["format"], json!(EXPORT_FORMAT)); assert_eq!(document["version"], json!(EXPORT_VERSION)); assert_eq!(document["exportedAt"], json!(NOW)); assert_eq!(document["workspaceId"], json!(fixture::WORKSPACE)); // Five years either side of the stamp, to the millisecond. assert_eq!( document["eventsWindow"], json!({ "from": "2021-09-08T10:00:00.000Z", "to": "2031-09-08T10:00:00.000Z" }) ); } /// RULE: An export carries only an account's last four digits. A raw imported bank number is store data, never data an exported read is allowed to carry. #[test] fn an_export_never_carries_a_full_bank_account_number() { let (_dir, client) = workspace(|db| { db.run( "INSERT INTO cotton_money_accounts \ (id, workspace_id, kind, subtype, name, currency, number_mask, created_at, updated_at) \ VALUES (?,?,'asset','bank','A synthetic bank account','INR',?,?,?)", &[ text("account-private-number"), text(fixture::WORKSPACE), text("12345678901234"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a synthetic bank account"); }); let document = export_of(&client); assert_eq!(document["money"]["accounts"][0]["numberMask"], "1234"); let text = document.to_string(); assert!(!text.contains("12345678901234"), "the full number escaped: {text}"); assert!(!text.contains("567890"), "the middle digits escaped: {text}"); } #[test] fn every_top_level_key_the_phone_s_document_has_is_written() { let (_dir, client) = workspace(|_| {}); let document = export_of(&client); for key in [ "format", "version", "exportedAt", "workspaceId", "eventsWindow", "collections", "todos", "events", "notes", "journal", "projectJournal", "people", "captures", "money", "documents", "photos", "videos", "truncated", ] { assert!( document.get(key).is_some(), "the export is missing `{key}`, which the TypeScript writes" ); } for key in ["accounts", "transactions", "statements", "statementLines"] { assert!( document["money"].get(key).is_some(), "money is missing `{key}`" ); } // Usually empty, and present either way — a document that cut a list in // silence would look complete and not be. assert_eq!(document["truncated"], json!({})); } /// RULE: An export never answers an account number in full, even when a legacy /// row stored one where the display mask belongs. #[test] fn account_numbers_in_an_export_are_limited_to_the_last_four() { let (_dir, client) = workspace(|db| { db.run( "INSERT INTO cotton_money_accounts (id, workspace_id, kind, subtype, name, currency, number_mask, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?)", &[ text("33333333-3333-4333-8333-333333333399"), text(fixture::WORKSPACE), text("asset"), text("bank"), text("Synthetic bank"), text("INR"), text("1234567890123456"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a synthetic account"); }); let exported = export_of(&client); let accounts = exported["money"]["accounts"] .as_array() .expect("accounts"); let account = accounts .iter() .find(|account| account["id"] == "33333333-3333-4333-8333-333333333399") .expect("the account"); assert_eq!(account["numberMask"], "3456"); assert_ne!(account["numberMask"], "1234567890123456"); } // ── what the reads leave out ────────────────────────────────────────────── #[test] fn a_dropped_todo_stays_out_and_an_archived_collection_with_it() { let (_dir, client) = workspace(|db| { a_calendar(db); db.run( "INSERT INTO cotton_todos (id, workspace_id, title, status, created_at, updated_at) \ VALUES (?,?,?,'dropped',?,?)", &[ text("todo-dropped"), text(fixture::WORKSPACE), text("A synthetic dropped todo"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a dropped todo"); }); let document = export_of(&client); assert!(!ids(&document, "todos").contains(&"todo-dropped".to_string())); assert_eq!(ids(&document, "collections"), vec!["calendar-a".to_string()]); } #[test] fn an_archived_note_a_managed_one_and_an_archived_person_are_all_absent() { let (_dir, client) = workspace(|db| { db.run( "INSERT INTO cotton_notes (id, workspace_id, kind, title, body, archived_at, \ created_at, updated_at) VALUES (?,?,'note',?,?,?,?,?)", &[ text("note-archived"), text(fixture::WORKSPACE), text("Filed away"), text("A synthetic archived note."), text("2026-09-06T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("an archived note"); db.run( "INSERT INTO cotton_notes (id, workspace_id, kind, title, body, managed_by, \ external_id, created_at, updated_at) VALUES (?,?,'note',?,?,?,?,?,?)", &[ text("note-managed"), text(fixture::WORKSPACE), text("A mirror"), text("A synthetic managed note."), text("a-synthetic-mirror"), text("synthetic-external-1"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a managed note"); }); let document = export_of(&client); let notes = ids(&document, "notes"); assert!(!notes.contains(&"note-archived".to_string())); assert!(!notes.contains(&"note-managed".to_string())); assert!(notes.contains(&"note-a".to_string())); assert!(!ids(&document, "people").contains(&"person-archived".to_string())); } #[test] fn a_project_s_journal_page_lands_in_its_own_key_and_not_in_the_owner_s() { let (_dir, client) = workspace(|db| { db.run( "INSERT INTO cotton_notes (id, workspace_id, kind, title, body, journal_date, \ project_id, created_at, updated_at) VALUES (?,?,'journal',?,?,?,?,?,?)", &[ text("journal-project"), text(fixture::WORKSPACE), text("A project day"), text("A synthetic project journal page."), text("2026-09-07"), text("project-a"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("a project journal page"); }); let document = export_of(&client); assert_eq!( ids(&document, "projectJournal"), vec!["journal-project".to_string()] ); let owner = ids(&document, "journal"); assert!(!owner.contains(&"journal-project".to_string())); assert!(owner.contains(&"journal-a".to_string())); } // ── the shapes that are not a plain rename ──────────────────────────────── #[test] fn a_birthday_is_one_object_over_three_columns_and_a_half_set_one_refuses() { let (_dir, client) = workspace(|db| { db.run( "UPDATE cotton_people SET birth_month = 4, birth_day = 11 WHERE id = 'person-a'", &[], ) .expect("a birthday"); }); let exported = export_of(&client); let person = exported["people"] .as_array() .expect("people") .iter() .find(|row| row["id"] == json!("person-a")) .expect("the person") .clone(); assert_eq!( person["birthday"], json!({ "month": 4, "day": 11, "year": Value::Null }) ); // The three columns are the birthday's parts, not fields of their own. assert!(person.get("birthMonth").is_none()); assert_eq!(person["phones"], json!([])); // The half-set case is unreachable through the file — `cotton_people` has a // CHECK that refuses one column without the other — so the reader's own // refusal is exercised against a row directly. It is the floor the // TypeScript keeps for the same reason: a month with no day would export as // a date nobody can read back. let refusal = birthday(&Row::new(vec![ ("birth_month".to_string(), SqlValue::Integer(4)), ("birth_day".to_string(), SqlValue::Null), ("birth_year".to_string(), SqlValue::Null), ])) .expect_err("half a birthday is refused"); assert!( refusal.contains("Both must be set, or neither"), "the refusal names the rule: {refusal}" ); // And a year, when the row carries one. assert_eq!( birthday(&Row::new(vec![ ("birth_month".to_string(), SqlValue::Integer(4)), ("birth_day".to_string(), SqlValue::Integer(11)), ("birth_year".to_string(), SqlValue::Integer(1990)), ])) .expect("a whole birthday"), json!({ "month": 4, "day": 11, "year": 1990 }) ); } // RULE (B1, 6 Nov 2026): a person whose birthday the object keeps whole — the month, day and year empty on a signed-in copy — is exported with it, as the same one object over month, day and year. #[test] fn a_birthday_the_object_keeps_whole_is_exported_with_the_person() { use cotton_store::schema::package_shape::{add_served, served_column}; let (_dir, client) = workspace(|db| { add_served(db, "cotton_people", &[served_column("birthday", "date", false).expect("a served column")]) .expect("the copy keeps the object's birthday"); db.run( "UPDATE cotton_people SET birth_month = NULL, birth_day = NULL, birth_year = NULL, birthday = '1988-11-20' WHERE id = 'person-a'", &[], ) .expect("a whole birthday"); }); let exported = export_of(&client); let person = exported["people"] .as_array() .expect("people") .iter() .find(|row| row["id"] == json!("person-a")) .expect("the person") .clone(); assert_eq!(person["birthday"], json!({ "month": 11, "day": 20, "year": 1988 })); } #[test] fn a_statement_line_a_transaction_cites_reads_booked_and_an_ignored_one_wins_over_it() { let (_dir, client) = workspace(a_statement_with_two_lines); let document = export_of(&client); let lines = document["money"]["statementLines"] .as_array() .expect("statement lines") .clone(); assert_eq!(lines.len(), 2); assert_eq!(lines[0]["id"], json!("line-booked")); assert_eq!(lines[0]["state"], json!("booked")); assert_eq!(lines[0]["transactionId"], json!("transaction-a")); // `ignored` wins over booked, and this one is cited by nobody anyway. assert_eq!(lines[1]["id"], json!("line-ignored")); assert_eq!(lines[1]["state"], json!("ignored")); assert_eq!(lines[1]["transactionId"], Value::Null); } #[test] fn the_vault_comes_out_with_its_passwords_because_files_nobody_can_open_are_not_an_export() { let (_dir, client) = workspace(a_statement_with_two_lines); let document = export_of(&client); let vault = document["documents"].as_array().expect("documents").clone(); assert_eq!(vault.len(), 1); assert_eq!(vault[0]["password"], json!("an-alpaca-password")); // The BYTES are not here — the path to them is. assert_eq!( vault[0]["storagePath"], json!("workspaces/synthetic/documents/synthetic.pdf") ); // An open bag, and an empty one rather than a null. assert_eq!(vault[0]["facts"], json!({})); } // ── the events window ───────────────────────────────────────────────────── #[test] fn an_event_outside_five_years_is_absent_and_a_repeating_one_inside_it_comes_out_once() { let (_dir, client) = workspace(|db| { a_calendar(db); an_event(db, "event-inside", "2026-09-09T09:00:00.000Z", None); an_event(db, "event-long-ago", "2015-01-01T09:00:00.000Z", None); an_event( db, "event-weekly", "2026-09-01T09:00:00.000Z", Some("FREQ=WEEKLY;COUNT=10"), ); // A calendar the person retired names its events and keeps none of // them: an event is the database's (27 Oct 2026). db.run( "INSERT INTO cotton_events (id, collection_id, title, starts_at, created_at, \ updated_at) VALUES (?,?,?,?,?,?)", &[ text("event-retired"), text("calendar-archived"), text("A synthetic retired appointment"), text("2026-09-09T09:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], ) .expect("an event on a retired calendar"); }); let document = export_of(&client); let events = ids(&document, "events"); assert!(events.contains(&"event-inside".to_string())); // Occurrences repeat; the ROWS are what an export owes you. assert_eq!( events.iter().filter(|id| *id == "event-weekly").count(), 1, "a repeating event is ONE row, however many occurrences it drew" ); assert!(!events.contains(&"event-long-ago".to_string())); assert!(events.contains(&"event-retired".to_string())); } #[test] fn a_binned_event_draws_no_occurrence_and_so_leaves_the_export() { let (_dir, client) = workspace(|db| { a_calendar(db); an_event(db, "event-binned", "2026-09-09T09:00:00.000Z", None); db.run( "UPDATE cotton_events SET trashed_at = ? WHERE id = 'event-binned'", &[text("2026-09-06T00:00:00.000Z")], ) .expect("the bin"); }); assert!(ids(&export_of(&client), "events").is_empty()); } // ── the ceiling, and the count ──────────────────────────────────────────── #[test] fn the_media_ceiling_is_stated_in_truncated_the_moment_it_bites() { let (_dir, client) = workspace(|db| { db.transaction(|db| { for index in 0..EXPORT_MEDIA_LIMIT { db.run( "INSERT INTO cotton_photos (id, workspace_id, key, sha256, content_type, \ size_bytes, taken_at, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?)", &[ text(&format!("photo:{index:064}")), text(fixture::WORKSPACE), text(&format!("synthetic/photo-{index:04}.jpg")), text(&format!("{index:064}")), text("image/jpeg"), SqlValue::Integer(1024), text(&format!("2026-09-08T00:00:{:02}.000Z", index % 60)), text("2026-09-01T00:00:00.000Z"), text("2026-09-01T00:00:00.000Z"), ], )?; } Ok(()) }) .expect("a thousand synthetic photos"); }); let document = export_of(&client); assert_eq!( document["photos"].as_array().expect("photos").len() as i64, EXPORT_MEDIA_LIMIT ); assert_eq!(document["truncated"], json!({ "photos": true })); // A picture's row shape, while there is one to look at: `favourite` is a // boolean and never null, and the two lists default rather than sit null. let photo = document["photos"][0].clone(); assert_eq!(photo["favourite"], json!(false)); assert_eq!(photo["subtypes"], json!([])); assert_eq!(photo["labels"], json!([])); // The BYTES are not here — the key is. assert!(photo["key"].as_str().expect("a key").ends_with(".jpg")); } #[test] fn the_count_is_records_and_never_their_halves() { let document = json!({ "todos": [1, 2], "events": [1], "notes": [1], "journal": [1], "projectJournal": [], "people": [1], "captures": [], "money": { "transactions": [1, 2, 3], // Counted by nobody: a line is half a transaction, and a statement // IS one of the documents below read into rows. "lines": [1, 2, 3, 4, 5, 6], "statements": [1, 2], "statementLines": [1, 2, 3], }, // A grant is something a document has, not a record of its own. "documents": [1], "photos": [1, 1], "videos": [1], }); assert_eq!(record_count(&document), 2 + 1 + 1 + 1 + 1 + 3 + 1 + 2 + 1); } // ── the file ────────────────────────────────────────────────────────────── #[test] fn the_file_is_named_for_the_day_and_lands_in_the_data_directory_s_exports_folder() { let dir = tempfile::tempdir().expect("a data directory"); let layout = Layout::new(dir.path()); let file_name = export_file_name(NOW_MS).expect("a file name"); assert_eq!(file_name, "cotton-export-2026-09-08.json"); let written = write_document(&layout, &file_name, &json!({ "format": EXPORT_FORMAT })) .expect("the document is written"); assert_eq!(written.path, layout.exports_dir().join(&file_name)); assert!(written.size_bytes > 0); let back: Value = serde_json::from_slice(&std::fs::read(&written.path).expect("the file reads")) .expect("the file is JSON"); assert_eq!(back["format"], json!(EXPORT_FORMAT)); } #[test] fn an_earlier_export_is_cleared_so_the_folder_holds_one_copy_of_a_life_and_not_ten() { let dir = tempfile::tempdir().expect("a data directory"); let layout = Layout::new(dir.path()); let first = write_document(&layout, "cotton-export-2026-09-07.json", &json!({})) .expect("yesterday's export"); let second = write_document(&layout, "cotton-export-2026-09-08.json", &json!({})) .expect("today's export"); assert!(!first.path.exists(), "yesterday's copy is gone"); assert!(second.path.exists()); let left: Vec = std::fs::read_dir(layout.exports_dir()) .expect("the folder reads") .flatten() .map(|entry| entry.file_name().to_string_lossy().to_string()) .collect(); assert_eq!(left, vec!["cotton-export-2026-09-08.json".to_string()]); } /// RULE: File bytes never cross into the app: a read answers with a path on disk. #[test] fn the_method_answers_a_path_and_a_count_and_never_the_document_itself() { let (_dir, client) = workspace(a_statement_with_two_lines); // What `build` composes, without an open core to hold the handle: the walk, // the count, and the file. let document = export_of(&client); let file_name = export_file_name(NOW_MS).expect("a file name"); let dir = tempfile::tempdir().expect("a data directory"); let written = write_document(&Layout::new(dir.path()), &file_name, &document) .expect("the document is written"); let answer = json!({ "path": written.path.to_string_lossy(), "fileName": file_name, "recordCount": record_count(&document), "sizeBytes": written.size_bytes, }); assert_eq!( answer.as_object().expect("an object").keys().len(), 4, "the answer is four fields: where it is, what it is called, how much of \ a life it holds and how big it is" ); assert!(answer["path"].as_str().expect("a path").ends_with(".json")); // Three todos and one transaction from the fixture and the seeder, plus the // notes, journal pages, people and the document. assert!(answer["recordCount"].as_i64().expect("a count") > 0); assert!(answer["sizeBytes"].as_u64().expect("a size") > 0); } // ── the method table ────────────────────────────────────────────────────── #[test] fn the_export_is_offered_on_every_build() { // A phone's card asks for it; a serving Mac walks the file it holds. The // method is the client half's, so no build is without it. let offered = crate::methods::methods(); assert!( offered.contains(&"export.build".to_string()), "every build offers the export by name" ); assert!(crate::methods::ALL_METHODS.contains(&"export.build")); assert!(crate::methods::CLIENT_METHODS.contains(&"export.build")); }