Skip to content

Commit

Permalink
fix: remove non_zero, test, merge (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Mubarak Muhammad Aminu <[email protected]>
  • Loading branch information
anonfedora and mubarak23 authored Oct 26, 2024
1 parent 0852210 commit 1efcc8c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/events/events.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,13 @@ pub mod Events {
};
event_details
}

fn event_owner(self: @ContractState, event_id: u256) -> ContractAddress {
get_caller_address()
let event_owners = self.event_owners.read(event_id);

event_owners
}

fn attendee_event_details(self: @ContractState, event_id: u256) -> EventRegistration {
let event_attendance_details = EventRegistration {
attendee_address: get_caller_address(),
Expand Down
18 changes: 18 additions & 0 deletions tests/test_contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,21 @@ fn test_event_emission() {

stop_cheat_caller_address(event_contract_address);
}

#[test]
#[available_gas(2000000)]
fn test_event_owner() {
let event_contract_address = __setup__();
let event_dispatcher = IEventDispatcher { contract_address: event_contract_address };

let user_address: ContractAddress = USER_ONE.try_into().unwrap();

start_cheat_caller_address(event_contract_address, user_address);

let event_id = event_dispatcher.add_event("bitcoin dev meetup", "Dan Marna road");
assert(event_id == 1, 'Event was not created');

let retrieved_owner = event_dispatcher.event_owner(1);
assert(retrieved_owner == user_address, 'Wrong owner returned');
stop_cheat_caller_address(event_contract_address);
}

0 comments on commit 1efcc8c

Please sign in to comment.