diff --git a/docs/docs/03-scaffold-suite.md b/docs/docs/03-scaffold-suite.md index 0dafe6a..b1921f4 100644 --- a/docs/docs/03-scaffold-suite.md +++ b/docs/docs/03-scaffold-suite.md @@ -14,10 +14,9 @@ In go-codegen, a test suite is a go project that contains test cases for an appl To scaffold the test suite, run the following command: - -```sh -go-codegen interchaintest scaffold -``` + + {`go-codegen interchaintest scaffold`} + This command will open an interactive prompt that will guide you through the process of creating a test suite. The prompt will ask you to provide the following information: diff --git a/docs/docs/04-add-contracts.md b/docs/docs/04-add-contracts.md index 6503d05..f7a2654 100644 --- a/docs/docs/04-add-contracts.md +++ b/docs/docs/04-add-contracts.md @@ -6,6 +6,7 @@ slug: /add-contracts --- import HighlightBox from '@site/src/components/HighlightBox'; +import CodeBlock from '@theme/CodeBlock'; # Add Contracts to the Test Suite @@ -25,16 +26,14 @@ There are a couple important things to note about this contract: - Since this contract was designed to be instantiated by other contracts, it does have the capability to make callbacks to an external contract on channel and packet lifecycle events. This is what the `callback-counter` test contract is for. - ```rust reference -https://github.com/srdtrk/cw-ica-controller/blob/d6b033092071e37f2dd015b58810a02257a92b6b/src/types/callbacks.rs#L15-L46 +https://github.com/srdtrk/awesomwasm-2024-workshop/blob/90ab7f61c743ec26c22fe3a1f3b8fac140a19a39/src/types/callbacks.rs#L15-L46 ``` - This contract automatically initiates the channel opening handshake when it is instantiated and doesn't allow any relayers to initiate the handshake. - ```rust reference -https://github.com/srdtrk/cw-ica-controller/blob/d6b033092071e37f2dd015b58810a02257a92b6b/src/types/msg.rs#L8-L21 +https://github.com/srdtrk/awesomwasm-2024-workshop/blob/90ab7f61c743ec26c22fe3a1f3b8fac140a19a39/src/types/msg.rs#L8-L21 ``` @@ -43,10 +42,9 @@ https://github.com/srdtrk/cw-ica-controller/blob/d6b033092071e37f2dd015b58810a02 In this test, we will only add the `cw-ica-controller` and `callback-counter` contracts to the test suite. To add the `cw-ica-controller` contract to the test suite, run the following command from the root of the workshop repository: - -```sh -go-codegen interchaintest add-contract schema/cw-ica-controller.json --suite-dir e2e/interchaintestv8 -``` + +{`go-codegen interchaintest add-contract schema/cw-ica-controller.json --suite-dir e2e/interchaintestv8`} + This command will generate the following files: @@ -64,10 +62,9 @@ e2e/interchaintestv8/ You can also add the `callback-counter` contract to the test suite by running the following command: - -```sh -go-codegen interchaintest add-contract testing/contracts/callback-counter/schema/callback-counter.json --suite-dir e2e/interchaintestv8 -``` + + {`go-codegen interchaintest add-contract testing/contracts/callback-counter/schema/callback-counter.json --suite-dir e2e/interchaintestv8`} + This command will generate the following files: @@ -97,8 +94,8 @@ go test -v . -run=TestWithContractTestSuite/TestContract Github Actions will not run the test in the generated `contract_test.go` file. To do this, you need to add the test to the `.github/workflows/e2e.yml` file. Moreover, when running the generated test in Github Actions, you will need to build all the contracts before running the test. -```yaml title=".github/workflows/e2e.yml" -# ... + +{`# ... build: strategy: fail-fast: false @@ -108,7 +105,7 @@ Github Actions will not run the test in the generated `contract_test.go` file. T - TestWithBasicTestSuite/TestBasic # plus-diff-line + - TestWithContractTestSuite/TestContract - name: ${{ matrix.test }} + name: \${{ matrix.test }} runs-on: ubuntu-latest steps: - name: Checkout sources @@ -144,8 +141,9 @@ Github Actions will not run the test in the generated `contract_test.go` file. T // plus-diff-end - name: Setup Go uses: actions/setup-go@v4 -# ... -``` +\# ... +`} + diff --git a/docs/src/theme/CodeBlock/index.tsx b/docs/src/theme/CodeBlock/index.tsx new file mode 100644 index 0000000..bcbddaa --- /dev/null +++ b/docs/src/theme/CodeBlock/index.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import CodeBlock from '@theme-original/CodeBlock'; +import type CodeBlockType from '@theme/CodeBlock'; +import type { WrapperProps } from '@docusaurus/types'; + +type Props = WrapperProps & { + source?: string; +} + +export default function CodeBlockWrapper(props: Props): JSX.Element { + const { source, ...codeBlockProps } = props; + return ( + <> + + {source && +
+ View Source +
+ } + + ); +}