Skip to content

Commit

Permalink
chore: change upvote and downvote event name
Browse files Browse the repository at this point in the history
  • Loading branch information
Adegbite Ademola Kelvin authored and Adegbite Ademola Kelvin committed Sep 12, 2024
1 parent 1c1dade commit 4d0e0cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/publication/publication.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pub mod PublicationComponent {
Post: Post,
CommentCreated: CommentCreated,
RepostCreated: RepostCreated,
UpvoteCreated: UpvoteCreated,
DownvoteCreated: DownvoteCreated
Upvoted: Upvoted,
Downvoted: Downvoted
}

#[derive(Drop, starknet::Event)]
Expand Down Expand Up @@ -68,14 +68,14 @@ pub mod PublicationComponent {
}

#[derive(Drop, starknet::Event)]
pub struct UpvoteCreated {
pub struct Upvoted {
publication_id: u256,
transaction_executor: ContractAddress,
block_timestamp: u64,
}

#[derive(Drop, starknet::Event)]
pub struct DownvoteCreated {
pub struct Downvoted {
publication_id: u256,
transaction_executor: ContractAddress,
block_timestamp: u64,
Expand Down Expand Up @@ -233,7 +233,7 @@ pub mod PublicationComponent {

self
.emit(
UpvoteCreated {
Upvoted {
publication_id: pub_id,
transaction_executor: caller,
block_timestamp: get_block_timestamp()
Expand Down Expand Up @@ -267,7 +267,7 @@ pub mod PublicationComponent {
self.vote_status.write((caller, pub_id), true);
self
.emit(
DownvoteCreated {
Downvoted {
publication_id: pub_id,
transaction_executor: caller,
block_timestamp: get_block_timestamp()
Expand Down
10 changes: 5 additions & 5 deletions tests/test_publication.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use snforge_std::{
EventAssertions
};
use karst::publication::publication::PublicationComponent::{
Event as PublicationEvent, Post, CommentCreated, RepostCreated, UpvoteCreated, DownvoteCreated
Event as PublicationEvent, Post, CommentCreated, RepostCreated, Upvoted, Downvoted
};


Expand Down Expand Up @@ -327,8 +327,8 @@ fn test_upvote_event_emission() {
let dispatcher = IComposableDispatcher { contract_address: publication_contract_address };
start_prank(CheatTarget::One(publication_contract_address), USER_ONE.try_into().unwrap());
dispatcher.upvote(user_one_profile_address, user_one_first_post_pointed_pub_id);
let expected_event = PublicationEvent::UpvoteCreated(
UpvoteCreated {
let expected_event = PublicationEvent::Upvoted(
Upvoted {
publication_id: user_one_first_post_pointed_pub_id,
transaction_executor: USER_ONE.try_into().unwrap(),
block_timestamp: get_block_timestamp()
Expand Down Expand Up @@ -359,8 +359,8 @@ fn test_downvote_event_emission() {
start_prank(CheatTarget::One(publication_contract_address), USER_SIX.try_into().unwrap());
let dispatcher = IComposableDispatcher { contract_address: publication_contract_address };
dispatcher.downvote(user_one_profile_address, user_one_first_post_pointed_pub_id);
let expected_event = PublicationEvent::DownvoteCreated(
DownvoteCreated {
let expected_event = PublicationEvent::Downvoted(
Downvoted {
publication_id: user_one_first_post_pointed_pub_id,
transaction_executor: USER_SIX.try_into().unwrap(),
block_timestamp: get_block_timestamp()
Expand Down

0 comments on commit 4d0e0cd

Please sign in to comment.