Skip to content

Commit 53ac1a7

Browse files
authored
Merge pull request #108 from viccuad/main
docs: Update README.md with NewMockWapcClient() mention
2 parents d30584b + 791804b commit 53ac1a7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Using this SDK requires **TinyGo 0.28.1 or later.**
8787
> **Warning**
8888
> Using an older version of TinyGo will result in runtime errors due to the limited support for Go reflection.
8989
90-
### Example
90+
### Example
9191

9292
This snippet shows how to implement a `validation` function that uses the
9393
"native Go types" approach:
@@ -280,12 +280,13 @@ The `Host` type described above relies on an internal `waPC` client that
280280
interacts with the host. At test time, the client is an instance of
281281
`MockWapcClient`.
282282

283-
Developers can create `MockWapcClient` instances using these two helper methods:
283+
Developers can create `MockWapcClient` instances using the `NewMockWapcClient`
284+
helper method from the `capabilities` package. It is used as follows:
284285

285-
- `NewSuccessfulMockWapcClient`: the client never fails, and always return the
286-
response payload provided by the user.
287-
- `NewFailingMockWapcClient`: the client always fails with the error
288-
provided by the user.
286+
```go
287+
mockWapcClient := &mocks.MockWapcClient{}
288+
mockWapcClient.On("HostCall", "kubewarden", "kubernetes", "get_resource", request).Return(wapcResponse, nil)
289+
```
289290

290291
# Project template
291292

0 commit comments

Comments
 (0)