Skip to content

Commit

Permalink
docs: adjust mock description
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim vasin committed Nov 17, 2022
1 parent 1cf840d commit 92f65ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,23 @@ await Matomo.isInitialized();

### Mocking

Add this line in your jest `setupFiles` configuration option from `package.json`
Add this to mock specific function as you wish

```js
jest.mock('@mccsoft/react-native-matomo', () => ({
initialize: () => Promise.resolve(),
trackEvent: () => Promise.resolve(),
trackView: () => Promise.resolve(),
...
}));
```

Or add this line in your jest `setupFiles` configuration to define default mocks.

```
"setupFiles": [
...
"./node_modules/@mccsoft/react-native-matomo/jest.setup.js"
"./node_modules/@mccsoft/react-native-matomo/jestSetup.js"
],
```

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"android",
"ios",
"cpp",
"jestSetup.js",
"*.podspec",
"!lib/typescript/example",
"!ios/build",
Expand Down Expand Up @@ -99,7 +100,7 @@
"tagName": "v${version}"
},
"npm": {
"publish": true
"publish": false
},
"github": {
"release": true
Expand Down

0 comments on commit 92f65ca

Please sign in to comment.