Skip to content

Commit 776836a

Browse files
committed
docs: add code examples to all mock functions
Closes #221
1 parent 178e72c commit 776836a

File tree

2 files changed

+276
-96
lines changed

2 files changed

+276
-96
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@ snsMock
229229
.rejects('mocked rejection');
230230
```
231231

232+
```typescript
233+
const throttlingError = new Error('mocked rejection');
234+
throttlingError.name = 'ThrottlingException';
235+
236+
snsMock
237+
.rejects(throttlingError);
238+
```
239+
240+
In `rejects()`, you can pass a string, an `Error` instance,
241+
or an object with properties.
242+
In each case, it will be converted to an `Error` instance.
243+
232244
Specify custom mock function:
233245

234246
```typescript

0 commit comments

Comments
 (0)