Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Th0rgal committed Jun 11, 2024
1 parent 54bd7fe commit 001e24f
Showing 1 changed file with 20 additions and 27 deletions.
47 changes: 20 additions & 27 deletions src/tests/naming/test_abuses.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ fn test_transfer_from_returns_false() {
set_contract_address(alpha);
let aller: felt252 = 35683102;

// we check how much a domain costs
let (_, price) = pricing.compute_buy_price(5, 365);

// we allow the naming to take our money
eth.approve(naming.contract_address, price);

// we buy with no resolver, no sponsor, no discount and empty metadata
// in pay_domain transferFrom will return false
naming
.buy(1, aller, 365, ContractAddressZeroable::zero(), ContractAddressZeroable::zero(), 0, 0);
}

#[test]
#[available_gas(2000000000)]
Expand Down Expand Up @@ -387,31 +398,13 @@ fn test_buy_empty_domain() {

// we buy with no resolver, no sponsor, no discount and empty metadata
naming
.buy(1, empty_domain, 365, ContractAddressZeroable::zero(), ContractAddressZeroable::zero(), 0, 0);
}

#[test]
#[available_gas(2000000000)]
#[should_panic(expected: ('domain can\'t be empty', 'ENTRYPOINT_FAILED'))]
fn test_buy_empty_domain() {
// setup
let (eth, pricing, identity, naming) = deploy();
let alpha = contract_address_const::<0x123>();

// we mint the id
set_contract_address(alpha);
identity.mint(1);

set_contract_address(alpha);
let empty_domain: felt252 = 0;

// we check how much a domain costs
let (_, price) = pricing.compute_buy_price(0, 365);

// we allow the naming to take our money
eth.approve(naming.contract_address, price);

// we buy with no resolver, no sponsor, no discount and empty metadata
naming
.buy(1, empty_domain, 365, ContractAddressZeroable::zero(), ContractAddressZeroable::zero(), 0, 0);
.buy(
1,
empty_domain,
365,
ContractAddressZeroable::zero(),
ContractAddressZeroable::zero(),
0,
0
);
}

0 comments on commit 001e24f

Please sign in to comment.