Browse Source

[docs] Added examples for async tests

0.7.0-breaking-rewrite
Muthu Kumar 6 years ago
parent
commit
ab5cae6f8d
  1. 20
      README.md

20
README.md

@ -54,7 +54,11 @@ gunner.test('sum should equal 3', expect => {
const sum = 1 + 2;
return expect(sum).equal(3);
});
```
Expecting multiple results:
```JavaScript
gunner.test('multiple expects should be true', expect => {
const a = 1 + 2;
const b = 'Hello World';
@ -66,6 +70,22 @@ gunner.test('multiple expects should be true', expect => {
});
```
Asynchronous tests:
```JavaScript
gunner.test('asynchronous test', async expect => {
const response = await axios.post(url, request);
const userObject = await db.find('userdetails', { username });
return [
expect(response.status).equal(200);
expect(userObject).deepEquals(testUser);
];
})
```
### Gunner#run
Starts running Gunner tests. Takes an options object as optional parameter.

Loading…
Cancel
Save