-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mock call bug #645
Comments
minimal reproduction: use starknet::ContractAddress;
use snforge_std::{start_mock_call, stop_mock_call};
#[starknet::interface]
trait IOracle<TContractState> {
fn get_price(self: @TContractState, token: ContractAddress) -> u128;
}
#[test]
fn test_mocking() {
let oracle_address = 'ORACLE'.try_into().unwrap();
start_mock_call(oracle_address, 'get_price', 69);
let oracle = IOracleDispatcher { contract_address: oracle_address };
// ^^ fails with: Contract not deployed at address: 0x00000000000000000000000000000000000000000000000000004f5241434c45
let price = oracle.get_price('TOKEN'.try_into().unwrap());
stop_mock_call(oracle_address, 'get_price');
assert(price == 69, 'should work');
} |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 13, 2023
<!-- Reference any GitHub issues resolved by this PR --> Closes #645 ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md` --------- Co-authored-by: Piotr Magiera <piotrmagiera150@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fails
The text was updated successfully, but these errors were encountered: