Skip to content

Commit

Permalink
feat: add tests (#3)
Browse files Browse the repository at this point in the history
* Revert "feat: remove all tests related files (#2)"

This reverts commit 7cb60d8.

* build: add patch for js-waku not found (#7)

When running the test with `jest`, it errored with
```
Cannot find module 'js-waku' from 'node_modules/@xmtp/xmtp-js/dist/cjs/src/utils.js'
```

The problem seems to be this issue
waku-org/js-waku#770.

Until this is resolved, we use a local patch as this only occurs when running tests.

* Add unit and integration tests

* Implement review remarks

Co-authored-by: Dong-Ha Kim <[email protected]>
Co-authored-by: Dennis Furrer <[email protected]>
  • Loading branch information
3 people authored Aug 3, 2022
1 parent 7f66a5d commit 0584ecc
Show file tree
Hide file tree
Showing 20 changed files with 8,181 additions and 4,474 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ await client.encodeAndSendMessage(messageObj, recipient);</pre>
<pre>npm run build</pre>
</li>
</ul>
<li>Test (TODO)</li>
<li>Test</li>
<ul>
<li>
<pre>npm run test</pre>
<pre>npm run test:all
npm run test:unit
npm run test:integration</pre>
</li>
</ul>
<li>Lint</li>
Expand Down
17 changes: 17 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
collectCoverage: true,
coverageDirectory: "coverage",
collectCoverageFrom: ["src/**/*.{ts,js}", "!src/example/*.{ts,js}"],
coverageReporters: ["json", "text"],
coveragePathIgnorePatterns: ["jest.config.js", "/node_modules/", "/dist/"],
globals: {
"ts-jest": {
tsconfig: "tsconfig.tests.json"
}
},
roots: ["<rootDir>"],
modulePaths: ["<rootDir>"],
moduleDirectories: ["node_modules"]
};
Loading

0 comments on commit 0584ecc

Please sign in to comment.