Skip to content

Commit

Permalink
Remove TestContact
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadai2010 committed Aug 11, 2024
1 parent e2a98a4 commit 55631dd
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions packages/snfoundry/contracts/src/test/TestContract.cairo
Original file line number Diff line number Diff line change
@@ -1,32 +1 @@
use contracts::YourContract::{IYourContractDispatcher, IYourContractDispatcherTrait};
use openzeppelin::utils::serde::SerializedAppend;
use snforge_std::{declare, ContractClassTrait};
use starknet::{ContractAddress, contract_address_const};

fn OWNER() -> ContractAddress {
contract_address_const::<'OWNER'>()
}

fn deploy_contract(name: ByteArray) -> ContractAddress {
let contract = declare(name).unwrap();
let mut calldata = array![];
calldata.append_serde(OWNER());
let (contract_address, _) = contract.deploy(@calldata).unwrap();
contract_address
}

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

let dispatcher = IYourContractDispatcher { contract_address };

let current_gretting = dispatcher.gretting();
let expected_gretting: ByteArray = "Building Unstoppable Apps!!!";
assert_eq!(current_gretting, expected_gretting, "Should have the right message on deploy");

let new_greeting: ByteArray = "Learn Scaffold-Stark 2! :)";
dispatcher.set_gretting(new_greeting.clone(), 0); // we transfer 0 eth

assert_eq!(dispatcher.gretting(), new_greeting, "Should allow setting a new message");
}

0 comments on commit 55631dd

Please sign in to comment.