Skip to content

Commit

Permalink
fix: minor fixes, adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Apr 12, 2023
1 parent 2793a58 commit abaa364
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
8 changes: 5 additions & 3 deletions docs/cli/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ aeproject env --stop

There are optional parameters **\-\-nodeVersion** and **\-\-compilerVersion**. To specify a specific version of node or compiler, or both
```text
aeproject env --nodeVersion v6.4.0
aeproject env --nodeVersion v6.8.1
# or
aeproject env --compilerVersion v6.1.0
aeproject env --compilerVersion v7.3.0
# or
aeproject env --nodeVersion v6.4.0 --compilerVersion v6.1.0
aeproject env --nodeVersion v6.8.1 --compilerVersion v7.3.0
```
This also applies to the commands `aeproject node` and `aeproject compiler`.

Expand All @@ -30,5 +30,7 @@ aeproject env --info

**Note**: By default AEproject uses the `latest-bundle` tag of the official [docker images](https://hub.docker.com/r/aeternity/aeternity/tags).

**Compatibility**: AEproject uses `@aeternity/aepp-sdk@13` which is only compatible using `node >= v6` and `compiler >= v7`, the only tested and recommended configuration, which also works on ARM64/Apple Silicon is from images `node v6.8.1` and `compiler v7.3.0`, upcoming newer versions with the same major version should work without issues.

## Disclaimer
- Firewalls and any other security feature can block your docker/docker-compose requests. Please check that docker/docker-compose is NOT in its blocked list or has permission to make requests.
22 changes: 11 additions & 11 deletions docs/cli/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Read [AEproject Library](../lib.md) for a more detailed explanation about the us

Provide your initializations in mocha which need to be done once before all tests:
```js
before(...)
before(async () => ...)
```

Initialize the default SDK instance with provided utils:
```js
const aeSdk = await utils.getSdk();
aeSdk = await utils.getSdk();
```

Get the filesystem definition for (custom) `includes` of the given contract:
Expand All @@ -47,17 +47,17 @@ const filesystem = utils.getFilesystem(EXAMPLE_CONTRACT_SOURCE);

Read the contract source from the filesystem:
```js
const source = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE);
const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE);
```

Initialize the contract instance:
```js
const contract = await aeSdk.getContractInstance({ source, filesystem });
contract = await aeSdk.initializeContract({ sourceCode, filesystem });
```

Deploy the contract:
```js
await contract.deploy();
await contract.init();
```

Create a snapshot of the chain state once before all tests. This allows you to rollback to a clean state after each test if needed:
Expand All @@ -76,13 +76,13 @@ afterEach(async () => {

```javascript
it('ExampleContract: set and get', async () => {
const set = await contract.methods.set(42, { onAccount: wallets[1].publicKey });
assert.equal(set.decodedEvents[0].name, 'SetXEvent');
assert.equal(set.decodedEvents[0].decoded[0], wallets[1].publicKey);
assert.equal(set.decodedEvents[0].decoded[1], 42);
const set = await contract.set(42, {onAccount: utils.getDefaultAccounts()[1]});
assert.equal(set.decodedEvents[0].name, 'SetXEvent');
assert.equal(set.decodedEvents[0].args[0], utils.getDefaultAccounts()[1].address);
assert.equal(set.decodedEvents[0].args[1], 42);

const { decodedResult } = await contract.methods.get();
assert.equal(decodedResult, 42);
const {decodedResult} = await contract.get();
assert.equal(decodedResult, 42);
});
```

Expand Down
2 changes: 1 addition & 1 deletion src/init/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"devDependencies": [
"@aeternity/aeproject@4",
"chai@4",
"mocha@9"
"mocha@10"
],
"uninstallDependencies": [
"aeproject",
Expand Down
2 changes: 1 addition & 1 deletion src/init/update-artifacts/test/exampleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ExampleContract', () => {
it('ExampleContract: set and get', async () => {
const set = await contract.set(42, { onAccount: utils.getDefaultAccounts()[1] });
assert.equal(set.decodedEvents[0].name, 'SetXEvent');
assert.equal(set.decodedEvents[0].args[0], await utils.getDefaultAccounts()[1].address);
assert.equal(set.decodedEvents[0].args[0], utils.getDefaultAccounts()[1].address);
assert.equal(set.decodedEvents[0].args[1], 42);

const { decodedResult } = await contract.get();
Expand Down

0 comments on commit abaa364

Please sign in to comment.