Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
- name: Install dependencies
run: yarn install --ignore-scripts

- name: Build essentials (sdk + helpers)
run: yarn build:essentials
- name: Build
run: yarn build

- name: Create Release PR or Publish (SDK)
- name: Create Release PR or Publish
id: changesets
uses: changesets/action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
dist
.env
.env
33 changes: 16 additions & 17 deletions packages/test-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a href="https://mimic.fi"><img src="https://www.mimic.fi/logo.png" alt="Mimic Protocol" width="200"></a>
</h1>

<h4 align="center">Blockchain automation protocol</h4>
<h4 align="center">Blockchain development platform</h4>

<p align="center">
<a href="https://github.com/mimic-protocol/tooling/actions/workflows/ci.yml">
Expand All @@ -23,7 +23,7 @@

---

## Content
## Content

This package provides tooling and helpers to write and run tests for Mimic Protocol tasks using TypeScript. It includes:

Expand All @@ -33,7 +33,7 @@ This package provides tooling and helpers to write and run tests for Mimic Proto

## Setup

To set up this project you'll need [git](https://git-scm.com) and [yarn](https://classic.yarnpkg.com) installed.
To set up this project you'll need [git](https://git-scm.com) and [yarn](https://classic.yarnpkg.com) installed.

Install the library from the root of the monorepo:

Expand All @@ -53,24 +53,24 @@ $ yarn
Here’s an example of how to test a Mimic task:

```ts
import { runTask } from '@mimicprotocol/test-ts'
import { expect } from 'chai'
import { runTask } from "@mimicprotocol/test-ts";
import { expect } from "chai";

const taskDir = './my-task'
const context = { user: '0x...', settler: '0x...', timestamp: Date.now() }
const inputs = { token: '0x...', amount: '10000000' }
const taskDir = "./my-task";
const context = { user: "0x...", settler: "0x...", timestamp: Date.now() };
const inputs = { token: "0x...", amount: "10000000" };

const intents = await runTask(taskDir, context, { inputs })
const intents = await runTask(taskDir, context, { inputs });

expect(intents).to.be.an('array').that.is.not.empty
expect(intents).to.have.lengthOf(1)
expect(intents).to.be.an("array").that.is.not.empty;
expect(intents).to.have.lengthOf(1);

expect(intents[0].type).to.be.equal('transfer')
expect(intents[0].settler).to.be.equal(context.settler)
expect(intents[0].type).to.be.equal("transfer");
expect(intents[0].settler).to.be.equal(context.settler);

expect(intents[0].transfers).to.have.lengthOf(1)
expect(intents[0].transfers[0].token).to.be.equal(inputs.token)
expect(intents[0].transfers[0].amount).to.be.equal(inputs.amount)
expect(intents[0].transfers).to.have.lengthOf(1);
expect(intents[0].transfers[0].token).to.be.equal(inputs.token);
expect(intents[0].transfers[0].amount).to.be.equal(inputs.amount);
```

For full task testing guide and examples please visit [docs.mimic.fi](https://docs.mimic.fi/)
Expand All @@ -87,7 +87,6 @@ for the safety of the protocol, please contact us through <a href="mailto:securi
This project is licensed under the GNU General Public License v3.0.
See the [LICENSE](../../LICENSE) file for details.


---

> Website [mimic.fi](https://mimic.fi) &nbsp;&middot;&nbsp;
Expand Down