-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,458 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,58 @@ | ||
import { | ||
SDKTestCase, | ||
keyAuth, | ||
validateBearerAuth, | ||
} from '../../../../testHelpers'; | ||
import { | ||
Verify2, | ||
} from '../../lib/'; | ||
|
||
export default [ | ||
{ | ||
label: 'cancel request', | ||
request: ['/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', 'DELETE'], | ||
response: [204], | ||
baseUrl: 'https://api.nexmo.com', | ||
reqHeaders: { | ||
authorization: validateBearerAuth, | ||
}, | ||
client: new Verify2(keyAuth), | ||
generator: false, | ||
error: false, | ||
requests: [ | ||
['/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', 'DELETE'], | ||
], | ||
responses: [ | ||
[204], | ||
], | ||
method: 'post', | ||
clientMethod: 'cancel', | ||
parameters: ['091e717f-8715-41a0-a3f0-cc04912deaa1'], | ||
expected: true, | ||
}, | ||
{ | ||
label: 'error when request not found', | ||
request: ['/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', 'DELETE'], | ||
response: [ | ||
404, | ||
{ | ||
title: 'Not Found', | ||
type: 'https://developer.vonage.com/api-errors#not-found', | ||
detail: 'Request <id> was not found or it has been verified already.', | ||
instance: 'bf0ca0bf927b3b52e3cb03217e1a1ddf', | ||
}, | ||
baseUrl: 'https://api.nexmo.com', | ||
reqHeaders: { | ||
authorization: validateBearerAuth, | ||
}, | ||
client: new Verify2(keyAuth), | ||
generator: false, | ||
error: false, | ||
requests: [ | ||
['/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', 'DELETE'], | ||
], | ||
responses: [ | ||
[ | ||
404, | ||
{ | ||
title: 'Not Found', | ||
type: 'https://developer.vonage.com/api-errors#not-found', | ||
detail: 'Request <id> was not found or it has been verified already.', | ||
instance: 'bf0ca0bf927b3b52e3cb03217e1a1ddf', | ||
}, | ||
], | ||
], | ||
method: 'delete', | ||
clientMethod: 'cancel', | ||
parameters: ['091e717f-8715-41a0-a3f0-cc04912deaa1'], | ||
expected: false, | ||
}, | ||
]; | ||
] as SDKTestCase<Verify2>[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,74 @@ | ||
import { CheckCodeRequest, CheckRequestResponse } from '../../lib/types'; | ||
import { | ||
SDKTestCase, | ||
keyAuth, | ||
validateBearerAuth, | ||
} from '../../../../testHelpers'; | ||
import { Verify2 } from '../../lib'; | ||
|
||
export default [ | ||
{ | ||
label: 'check code', | ||
request: [ | ||
'/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
'POST', | ||
{ | ||
code: '123456', | ||
} as CheckCodeRequest, | ||
baseUrl: 'https://api.nexmo.com', | ||
reqHeaders: { | ||
authorization: validateBearerAuth, | ||
}, | ||
client: new Verify2(keyAuth), | ||
generator: false, | ||
error: false, | ||
requests: [ | ||
[ | ||
'/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
'POST', | ||
{ | ||
code: '123456', | ||
} as CheckCodeRequest, | ||
], | ||
], | ||
response: [ | ||
200, | ||
{ | ||
request_id: '091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
status: 'complete', | ||
} as CheckRequestResponse, | ||
responses: [ | ||
[ | ||
200, | ||
{ | ||
request_id: '091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
status: 'complete', | ||
} as CheckRequestResponse, | ||
], | ||
], | ||
method: 'post', | ||
clientMethod: 'checkCode', | ||
parameters: ['091e717f-8715-41a0-a3f0-cc04912deaa1', '123456'], | ||
expected: 'complete', | ||
}, | ||
{ | ||
label: 'error when request not found', | ||
request: [ | ||
'/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
'POST', | ||
{ | ||
code: '123456', | ||
} as CheckCodeRequest, | ||
baseUrl: 'https://api.nexmo.com', | ||
reqHeaders: { | ||
authorization: validateBearerAuth, | ||
}, | ||
client: new Verify2(keyAuth), | ||
generator: false, | ||
error: 'Request failed with status code 404', | ||
requests: [ | ||
[ | ||
'/v2/verify/091e717f-8715-41a0-a3f0-cc04912deaa1', | ||
'POST', | ||
{ | ||
code: '123456', | ||
} as CheckCodeRequest, | ||
], | ||
], | ||
response: [ | ||
404, | ||
{ | ||
title: 'Not Found', | ||
type: 'https://developer.vonage.com/api-errors#not-found', | ||
detail: 'Request <id> was not found or it has been verified already.', | ||
instance: 'bf0ca0bf927b3b52e3cb03217e1a1ddf', | ||
}, | ||
responses: [ | ||
[ | ||
404, | ||
{ | ||
title: 'Not Found', | ||
type: 'https://developer.vonage.com/api-errors#not-found', | ||
detail: 'Request <id> was not found or it has been verified already.', | ||
instance: 'bf0ca0bf927b3b52e3cb03217e1a1ddf', | ||
}, | ||
], | ||
], | ||
method: 'post', | ||
clientMethod: 'checkCode', | ||
parameters: ['091e717f-8715-41a0-a3f0-cc04912deaa1', '123456'], | ||
expected: true, | ||
error: 'Request failed with status code 404', | ||
}, | ||
]; | ||
] as SDKTestCase<Verify2>[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import requestTests from './verify'; | ||
import checkTests from './check'; | ||
import cancelTests from './cancel'; | ||
import templateTests from './templates'; | ||
|
||
export default [ | ||
{ | ||
label: 'Request tests', | ||
name: 'Request tests', | ||
tests: requestTests, | ||
}, | ||
{ | ||
label: 'Check tests', | ||
name: 'Check tests', | ||
tests: checkTests, | ||
}, | ||
{ | ||
label: 'Cancel tests', | ||
name: 'Cancel tests', | ||
tests: cancelTests, | ||
}, | ||
{ | ||
name: 'Templates tests', | ||
tests: templateTests, | ||
} | ||
]; |
Oops, something went wrong.