-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,39 @@ | ||
// #[cfg(test)] | ||
// mod tests { | ||
// use starknet::class_hash::Felt252TryIntoClassHash; | ||
#[cfg(test)] | ||
mod tests { | ||
use starknet::class_hash::Felt252TryIntoClassHash; | ||
|
||
// // import world dispatcher | ||
// use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; | ||
// import world dispatcher | ||
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait}; | ||
|
||
// // import test utils | ||
// use dojo::test_utils::{spawn_test_world, deploy_contract}; | ||
// import test utils | ||
use dojo::test_utils::{spawn_test_world, deploy_contract}; | ||
|
||
// // import test utils | ||
// use dojo_starter::{ | ||
// systems::{actions::{actions, IActionsDispatcher, IActionsDispatcherTrait}}, | ||
// models::{position::{Position, Vec2, position}, moves::{Moves, Direction, moves}} | ||
// }; | ||
use kingdom_lord::tests::utils::setup_world; | ||
use kingdom_lord::models::{ | ||
resource_field::{ResourceField, resource_field}, warehouse::{Warehouse, warehouse}, | ||
barn::{Barn, barn} | ||
}; | ||
|
||
use kingdom_lord::systems::actions::{actions, actions::{ResourceActionsDispatcher, ResourceActionsDispatcherTrait, AdminActionsDispatcher, AdminActions}}; | ||
#[test] | ||
#[available_gas(30000000)] | ||
fn test_mine() { | ||
// caller | ||
let caller = starknet::contract_address_const::<0x0>(); | ||
|
||
// #[test] | ||
// #[available_gas(30000000)] | ||
// fn test_move() { | ||
// // caller | ||
// let caller = starknet::contract_address_const::<0x0>(); | ||
// models | ||
let mut models = array![resource_field::TEST_CLASS_HASH, warehouse::TEST_CLASS_HASH, barn::TEST_CLASS_HASH]; | ||
|
||
// // models | ||
// let mut models = array![position::TEST_CLASS_HASH, moves::TEST_CLASS_HASH]; | ||
// deploy world with models | ||
let world = spawn_test_world(models); | ||
|
||
// // deploy world with models | ||
// let world = spawn_test_world(models); | ||
// deploy systems contract | ||
let contract_address = world | ||
.deploy_contract('salt', actions::TEST_CLASS_HASH.try_into().unwrap()); | ||
let actions_system = ResourceActionsDispatcher { contract_address }; | ||
|
||
// // deploy systems contract | ||
// let contract_address = world | ||
// .deploy_contract('salt', actions::TEST_CLASS_HASH.try_into().unwrap()); | ||
// let actions_system = IActionsDispatcher { contract_address }; | ||
// call spawn() | ||
actions_system.spawn(); | ||
|
||
// // call spawn() | ||
// actions_system.spawn(); | ||
|
||
// // call move with direction right | ||
// actions_system.move(Direction::Right); | ||
|
||
// // Check world state | ||
// let moves = get!(world, caller, Moves); | ||
|
||
// // casting right direction | ||
// let right_dir_felt: felt252 = Direction::Right.into(); | ||
|
||
// // check moves | ||
// assert(moves.remaining == 99, 'moves is wrong'); | ||
|
||
// // check last direction | ||
// assert(moves.last_direction.into() == right_dir_felt, 'last direction is wrong'); | ||
|
||
// // get new_position | ||
// let new_position = get!(world, caller, Position); | ||
|
||
// // check new position x | ||
// assert(new_position.vec.x == 11, 'position x is wrong'); | ||
|
||
// // check new position y | ||
// assert(new_position.vec.y == 10, 'position y is wrong'); | ||
// } | ||
// } | ||
} | ||
} |