Skip to main content
Unit tests (Rust): Test the business-logic guards on the native target with cargo test. Each function takes the raw input bytes and returns Result<Vec<u8>, String>, so you call it directly and assert on the error string — there is no ContractError enum or test harness to set up. Functions that call the host (http, kv-store) only run on wasm32; natively they return an error, so unit tests focus on input parsing and validation.
Test checklist:
  • Happy path: search-offersbook-offer returns { id, pnr, status }.
  • Input hygiene: book-offer accepts only offer_id, passenger_id, total_amount, total_currency — any payload carrying passenger PII is rejected.
  • PII never in output: passport, date_of_birth, and name fields do not appear in any return value or log line.
  • The {{profile.*}} markers stay literal in the contract — resolution happens host-side, so they never appear resolved in WASM memory.