Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
  • Loading branch information
Neeharika-Sompalli committed May 13, 2024
1 parent 249f840 commit bdf038d
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void doesntFailIfFallbackNftTransferredToUnknownAlias() {
}

@Test
void skipsIfRoyaltyAlreadyPaid() {
void skipsIfRoyaltyAlreadyPaidByReceiver() {
result = new AssessmentResult(List.of(nftTransferListWithAlias), List.of());
// Include royalty already paid
result.addToRoyaltiesPaid(Pair.of(funding, firstFungibleTokenId));
Expand All @@ -210,6 +210,25 @@ void skipsIfRoyaltyAlreadyPaid() {
verify(fixedFeeAssessor, never()).assessFixedFee(any(), any(), any(), any());
}

@Test
void assessRoyaltyOnlyOncePerTokenType() {
result = new AssessmentResult(List.of(nftTransferListWithAlias), List.of());
// Include royalty already paid by sender
result.addToRoyaltiesPaid(Pair.of(payer, firstFungibleTokenId));

final var royaltyCustomFee = withRoyaltyFee(
royaltyFee.copyBuilder().fallbackFee(htsFallbackFee).build(), targetCollector);
final var fixedFee = withFixedFee(this.fixedFee, otherCollector);

final CustomFeeMeta feeMeta = withCustomFeeMeta(List.of(fixedFee, royaltyCustomFee), NON_FUNGIBLE_UNIQUE);

subject.assessRoyaltyFees(feeMeta, payer, funding, result);

assertThat(result.getAssessedCustomFees()).isEmpty();

verify(fixedFeeAssessor, never()).assessFixedFee(any(), any(), any(), any());
}

@Test
void reclaimsFromExchangeValueWhenAvailable() {
final var accountAmounts = List.of(AccountAmount.newBuilder()
Expand Down

0 comments on commit bdf038d

Please sign in to comment.