Basechain
  • About Basechain
  • Base BigBang Language
    • Introduction
    • 1. Getting started
      • 1.1 Installing BigBangNet
      • 1.2 BigBang basics
    • 2. Type
      • 2.1 Primitives
      • 2.2 Sequences
      • 2.3 Composites
    • 3. Keywords
    • 4. Storing data
      • 4.1 Constants
      • 4.2 Variables
      • 4.3 Maps
    • 5. Functions
      • 5.1 Public functions
      • 5.2 Private functions
      • 5.3 Read-only functions
  • 6. Control flow & error handling
    • 6.1 Asserts
    • 6.2 Try
    • 6.3 Unwrap flavours
    • 6.4 Response checking
  • 7. Using BigBangNet
    • 7.1 Creating a new project
    • 7.2 Writing your first contract
    • 7.3 Interacting with your contract
    • 7.4 Testing your contract
  • 8. Practice projects
    • 8.1 Time-locked wallet
    • 8.2 Smart claimant
    • 8.3 Multi-signature vault
  • 9. Traits
    • 9.1 Defining traits
    • 9.2 Implement traits
    • 9.3 Passing traits as arguments
  • 10. Building a marketplace
    • 10.1 Setup
    • 10.2 Listing & cancelling
    • 10.3 Fulfilling listings
    • 10.4 Uni tests
  • 11. Runtime cost analysis
  • Nodes & Miners
    • Run a Node with Docker
    • Run a Node with DigitalOcean
    • Run a Node with a Hosted Provider
    • Base Node Configuration
    • Mine testnet Base tokens
    • Verify Miner
    • Miner costs and fees
  • Website
  • X(Twitter)
  • Github
Powered by GitBook
On this page
  1. 10. Building a marketplace

10.4 Uni tests

The contract for the small market is larger than our previous ones.

We will structure the unit tests to minimize repetition by creating helper functions for common actions, such as converting an account and contract name into a contract principal string, and minting new tokens for testing purposes, including NFTs and payment assets. To assert that an NFT token transfer has occurred, please note that BigBangNet does not currently support this feature.

To create an order tuple or transaction for common actions, such as whitelisting an asset contract or listing an NFT, please use the provided helpers. In order to avoid hard-coding contract names in our tests, we define a constant for each. The helper functions construct the contract call to the mint function and include it in a mined block. The chain and deployer parameters are passed in by the tests. The functions return helpful information, such as the NFT asset contract principal, token ID or amount, and block data.

Previous10.3 Fulfilling listingsNext11. Runtime cost analysis

Last updated 1 year ago