Additional invalid tests cases
Use it.each to run the same test with various invalid test data
This commit is contained in:
parent
dc5e8af63e
commit
7920bbe1c0
|
@ -31,12 +31,19 @@ const runTelemetryAPITest = () => {
|
|||
.create();
|
||||
} );
|
||||
|
||||
it( 'errors for missing fields', async () => {
|
||||
await client
|
||||
.post( `/wc/v3/telemetry` )
|
||||
it.each([
|
||||
null,
|
||||
{},
|
||||
{ platform: 'ios' },
|
||||
{ version: '1.1' },
|
||||
])( 'errors for invalid request body - %p', async data => {
|
||||
const response = await client
|
||||
.post( `/wc/v3/telemetry`, data )
|
||||
.catch( err => {
|
||||
expect( err.statusCode ).toBe( 400 );
|
||||
} );
|
||||
|
||||
expect( response ).toBeUndefined();
|
||||
} );
|
||||
|
||||
it( 'returns 200 with correct fields', async () => {
|
||||
|
|
Loading…
Reference in New Issue