Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
DariuszDepta committed Sep 3, 2024
1 parent a379ee2 commit ffb6739
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
34 changes: 29 additions & 5 deletions src/pages/cw-multi-test/app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
tags: ["multitest", "App"]
---

# `App`
# App

The `App{:rust}` struct in **`MultiTest`** represents the whole blockchain simulator. When creating
the `App{:rust}`, it simulates the startup of a real-life blockchain within tests that utilize
**`MultiTest`**.

<br />

<div
style={{
Expand Down Expand Up @@ -34,9 +40,7 @@ tags: ["multitest", "App"]
</div>
</div>

The `App{:rust}` struct in **`MultiTest`** represents the whole blockchain simulator. When creating
the `App{:rust}`, it simulates the startup of a real-life blockchain within tests that utilize
**`MultiTest`**.
## `App::default`

The most straightforward way to create the `App{:rust}` is by using the `default` method, which is
the equivalent of calling the `new` constructor with an empty initialization callback.
Expand All @@ -54,7 +58,7 @@ let app = App::new(no_init);
```

In both cases, the newly created `App{:rust}` object simulates a blockchain with the default
settings, as summarized below:
settings, as summarized in the table below:

| Feature | Default implementation |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -69,3 +73,23 @@ settings, as summarized below:
| [Wasm](wasm) | [`WasmKeeper{:rust}`](https://docs.rs/cw-multi-test/latest/cw_multi_test/struct.WasmKeeper.html) |
| [Custom](custom) | [`FailingModule<Empty, Empty, Empty>{:rust}`](https://docs.rs/cw-multi-test/latest/cw_multi_test/struct.FailingModule.html) |
| [IBC](ibc) | [`IbcFailingModule{:rust}`](https://docs.rs/cw-multi-test/latest/cw_multi_test/type.IbcFailingModule.html) |

## `App::new`

(todo)

## Storing smart contract's code

(todo)

## Instantiating smart contract

(todo)

## Querying smart contract

(todo)

## Executing smart contract's message

(todo)
15 changes: 13 additions & 2 deletions src/pages/cw-multi-test/blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
tags: ["multitest", "blocks"]
---

import { Callout } from "nextra/components";

# Blocks

There are several cases when testing CosmWasm smart contracts requires simulating delays on the
Expand All @@ -16,8 +18,17 @@ blockchain, like:

## Operations on blocks

**`MultiTest`** provides several options to initialize and update the current block properties (such
as height and timestamp), to test delays on the blockchain.
**`MultiTest`** provides several operations to initialize and update current block properties, such
as height and timestamp, in order to test delays on the blockchain.

<Callout emoji="🚨">
Although it is possible to modify only the height or only the timestamp of the block in MultiTest,
this is not possible in a real-life blockchain and may lead to unpredictable test results.
</Callout>

<Callout type="info">
Always increment the height **and** the timestamp of the block in tests.
</Callout>

## Initialization with the default block

Expand Down

0 comments on commit ffb6739

Please sign in to comment.