diff --git a/docs/how-to-test-a-contract.md b/docs/how-to-test-a-contract.md index f8e653afb..1f516fc23 100644 --- a/docs/how-to-test-a-contract.md +++ b/docs/how-to-test-a-contract.md @@ -155,19 +155,6 @@ describe('Test SmartContract `Demo`', () => { }) ``` -## Shallow Copy - -Sometimes, if you only want to do a shallow copy of some properties, you can pass in the property names as an optional argument like this: - -```ts -const nextInstance = instance.next( - { - refCloneProps: ['prop1', 'prop2'] - } -) -``` -In this context the `next` is designed to create a shallow copy of the specified properties, allowing for selective copy rather than a complete copy of the entire contract instance. - ## Run tests @@ -271,6 +258,19 @@ nextInstance.increment(); ``` This is the **SAME** method we call on chain in `incrementOnChain`, thanks to the fact that both the on-chain smart contract and off-chain code are written in TypeScript. +#### Shallow Copy + +Sometimes, if you only want to do a shallow copy of some properties, you can pass in the property names as an optional argument like this: + +```ts +const nextInstance = instance.next( + { + refCloneProps: ['prop1', 'prop2'] + } +) +``` +In this context the `next` is designed to create a shallow copy of the specified properties, allowing for selective copy rather than a complete copy of the entire contract instance. + ### 3. Call the method on the `current` instance to apply updates on chain As described in [this section](#call-a-public-method), we can build a call transaction. The only difference here is that we pass in the `next` instance and its balance as a method call option in a stateful contract. So the method (i.e., `incrementOnChain`) have all the information to verify that all updates made to the `next` instance follow the state transition rules in it.