use serde_json::Value; // RULE: Each imported row keeps its source id as an indexed text fact, so rerunning an export can find its row without writing duplicates or letting an authored edit replace its source identity. #[test] fn parse_import_source_ids_are_typed_and_indexed() { for source in [ include_str!("../kits/yoga/tables/yoga_member.json"), include_str!("../kits/yoga/tables/yoga_pack.json"), include_str!("../kits/yoga/tables/yoga_attendance.json"), ] { let definition: Value = serde_json::from_str(source).unwrap(); let column = definition["columns"] .as_array() .unwrap() .iter() .find(|c| c["key"] == "import_id") .expect("the row keeps its source id"); assert_eq!(column["type"], "text"); assert_eq!(column["indexed"], true); assert_ne!(column["required"], true); assert_eq!(column["readonly"], true); } } // RULE: A real walk-in or imported history has no booking to invent. #[test] fn attendance_booking_is_optional() { let definition: Value = serde_json::from_str(include_str!("../kits/yoga/tables/yoga_attendance.json")).unwrap(); let booking = definition["columns"].as_array().unwrap().iter().find(|c| c["key"] == "booking").unwrap(); assert_ne!(booking["required"], true); }