Minor spacing adjustments, updated readme, added comments

This commit is contained in:
Greg 2021-08-23 14:51:33 -06:00
parent 37f1284ccb
commit a271c4a04b
3 changed files with 19 additions and 4 deletions

View File

@ -73,7 +73,7 @@ jest --group=api
### Test groups
This package makes use of the `jest-runner-groups` package, which allows grouping tests together around semantic groups (such as `orders` API calls, or `coupon` API calls) to make running test suites more granular.
This package makes use of the `jest-runner-groups` package, which allows grouping tests together around semantic groups (such as `orders` API calls, or `coupons` API calls) to make running test suites more granular.
Before the `describe()` statement, add in a doc block containing the desired groups:
@ -117,7 +117,7 @@ You can make use of the REST API log plugin to see how requests are being made,
## Generate a Postman Collection
This package also allows generating a `collection.json` file that can be imported into Postman and other REST clients that support the Postman v2 collection. To generate this file, run:
This package also allows generating a `collection.json` file using the test data in this package. This file can be imported into Postman and other REST clients that support the Postman v2 collection. To generate this file, run:
```
npm run make:collection

View File

@ -1,3 +1,11 @@
/**
* Customer billing object.
*
* Used in the following APIs:
* https://woocommerce.github.io/woocommerce-rest-api-docs/#customers
* https://woocommerce.github.io/woocommerce-rest-api-docs/#orders
*
*/
const customerBilling = {
first_name: 'John',
last_name: 'Doe',
@ -12,6 +20,13 @@ const customerBilling = {
email: 'john.doe@example.com',
}
/**
* Customer shipping object.
*
* Used in the following APIs:
* https://woocommerce.github.io/woocommerce-rest-api-docs/#customers
* https://woocommerce.github.io/woocommerce-rest-api-docs/#orders
*/
const customerShipping = {
first_name: 'Tim',
last_name: 'Clark',

View File

@ -10,12 +10,12 @@ describe('Test API connectivity', () => {
it('can access a non-authenticated endpoint', async () => {
const result = await getRequest( '' );
expect(result.statusCode).toEqual(200);
expect( result.statusCode ).toEqual( 200 );
});
it('can access an authenticated endpoint', async () => {
const result = await getRequest( 'system_status' );
expect(result.statusCode).toEqual(200);
expect( result.statusCode ).toEqual( 200 );
});
});