# Userとオペレータのやり取りに関するテスト設計 ###### tags: `テスト設計` ## sru_call - view関数の呼び出しができ、戻り値が取得できる - コントラクトがない場合はエラーが返る - コントラクトを呼び出してエラーがあった場合はエラーが返る ```javascript= describe("sru_call", () => { // view関数の呼び出しができ、戻り値が取得できる it("should call and get results", () => {}); // コントラクトがない場合はエラーが返る it("should not get result with no contract"); // コントラクトを呼び出してエラーがあった場合はエラーが返る it("should get error when there is an error in calling the contract", () => {}); }); ``` ## sru_sendTransaction ```javascript= describe("sru_sendTransaction", () => { // zkpのproofがないとエラーが返る it("should fail without zkproof", () => {}); // zkpのproofをverifyしてinvalidな場合エラーが返る it("should fail with verifying invalid zkproof", () => {}); // zkpのproofがvalidでもuser state rootが一致しなければラーが返る it("should fail with invalid user state root", () => {}); // 手数料を支払っていないと、エラーが返る it("should fail without fee payment", () => {}); // txの異常時にエラーを返す it("should success with invalid tx", () => {}); // 正常時に正常なレスポンスを返す it("should success with valid proof & tx", () => {}); }); ``` ## src_getReciept ```javascript= describe("src_getReciept", () => { // レシートを取得できる it("should get reciept with valid txhash", () => {}); // 存在しないレシートの場合はエラーが返る it("should get error with invalid txhash", () => {}); }); ```