Skip to content

Commit

Permalink
update test contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuh2511 committed Sep 30, 2024
1 parent 936cb6d commit 8bee6d9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/snfoundry/contracts/src/test/TestContract.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use contracts::YourContract::{IYourContractDispatcher, IYourContractDispatcherTrait};
use openzeppelin_utils::serde::SerializedAppend;
use snforge_std::{declare, ContractClassTrait, DeclareResultTrait};
use starknet::{ContractAddress, contract_address_const};
Expand All @@ -15,4 +16,16 @@ fn deploy_contract(name: ByteArray) -> ContractAddress {
}

#[test]
fn test_deployment_values() {}
fn test_deployment_values() {
let contract_address = deploy_contract("YourContract");

let dispatcher = IYourContractDispatcher { contract_address };

let current_greeting = dispatcher.greeting();
let expected_greeting: ByteArray = "Building Unstoppable Apps!!!";
assert(current_greeting == expected_greeting, 'Should have the right message');

let new_greeting: ByteArray = "Learn Scaffold-Stark 2! :)";
dispatcher.set_greeting(new_greeting.clone(), 0); // we transfer 0 eth
assert(dispatcher.greeting() == new_greeting, 'Should allow set new message');
}

0 comments on commit 8bee6d9

Please sign in to comment.