Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(contracts): assert the knock deadline and that settling leaves the price alone

nirholas24c0207abc4d
diff --git a/contracts/program-tests/tests/knock_escrow.rs b/contracts/program-tests/tests/knock_escrow.rs
index 0828a1129..6f02d1fe7 100644
--- a/contracts/program-tests/tests/knock_escrow.rs
+++ b/contracts/program-tests/tests/knock_escrow.rs
@@ -54,6 +54,9 @@ const WINDOW: i64 = 60 * 60 * 24;
const FEE_BPS: u16 = 250;
/// Decoded `Door` (borsh, after the 8-byte discriminator).
+// Every field is decoded so the struct mirrors the on-chain layout; not every
+// test reads every one.
+#[allow(dead_code)]
struct Door {
price: u64,
open: bool,
@@ -75,6 +78,9 @@ fn decode_door(data: &[u8]) -> Door {
}
/// Decoded `KnockRecord`.
+// Every field is decoded so the struct mirrors the on-chain layout; not every
+// test reads every one.
+#[allow(dead_code)]
struct KnockRec {
amount: u64,
fee_bps: u16,
@@ -399,6 +405,11 @@ fn ke1_answer_splits_the_payment_and_empties_the_vault() {
let k = h.knock_state(1);
assert_eq!(k.state, STATE_ANSWERED);
+ assert_eq!(
+ k.expires_at,
+ TEST_UNIX_TIMESTAMP + WINDOW,
+ "the deadline is the door's window from the moment of the knock"
+ );
assert_eq!(
k.reply_hash,
sha256(b"here is my reply"),
@@ -406,6 +417,7 @@ fn ke1_answer_splits_the_payment_and_empties_the_vault() {
);
let d = h.door_state();
+ assert_eq!(d.price, PRICE, "settling a knock does not move the door price");
assert_eq!((d.knocks, d.answered, d.refunded), (1, 1, 0));
assert_eq!(d.earned, PRICE - fee, "earned counts the payout, not the fee");
}