forked from wiringbits/block-explorer
-
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
1 parent
c0b2f01
commit 77bc6b4
Showing
2 changed files
with
39 additions
and
1 deletion.
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
38 changes: 38 additions & 0 deletions
38
server/test/com/xsn/explorer/models/TransactionInfoSpec.scala
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.xsn.explorer.models | ||
|
||
import com.xsn.explorer.helpers.DataGenerator | ||
import com.xsn.explorer.models.values._ | ||
import org.scalatest.matchers.must.Matchers | ||
import org.scalatest.wordspec.AnyWordSpec | ||
|
||
class TransactionInfoSpec extends AnyWordSpec with Matchers with DataGenerator { | ||
"fee" should { | ||
"calculate the paid fee" in { | ||
val transactionInfo = TransactionInfo( | ||
randomTransactionId, | ||
randomBlockhash, | ||
0L, | ||
Size(0), | ||
BigDecimal(125), | ||
BigDecimal(25), | ||
Height(0) | ||
) | ||
|
||
transactionInfo.fee mustBe BigDecimal(100) | ||
} | ||
|
||
"return 0 when result would be negative" in { | ||
val transactionInfo = TransactionInfo( | ||
randomTransactionId, | ||
randomBlockhash, | ||
0L, | ||
Size(0), | ||
BigDecimal(25), | ||
BigDecimal(125), | ||
Height(0) | ||
) | ||
|
||
transactionInfo.fee mustBe BigDecimal(0) | ||
} | ||
} | ||
} |