File tree Expand file tree Collapse file tree 6 files changed +1265
-1302
lines changed Expand file tree Collapse file tree 6 files changed +1265
-1302
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " aws-testing-library" ,
3- "version" : " 1.0.2 " ,
3+ "version" : " 1.0.3 " ,
44 "description" : " Chai and Jest matchers for aws services" ,
55 "scripts" : {
66 "lint" : " tslint 'src/**/*.ts'" ,
4343 "license" : " MIT" ,
4444 "devDependencies" : {
4545 "@types/chai" : " ^4.1.7" ,
46- "@types/jest" : " ^23.3.2 " ,
47- "@types/jest-diff" : " ^20.0.0 " ,
48- "@types/jest-matcher-utils" : " ^21.0.1 " ,
46+ "@types/jest" : " ^24.0.13 " ,
47+ "@types/jest-diff" : " ^20.0.1 " ,
48+ "@types/jest-matcher-utils" : " ^21.0.2 " ,
4949 "@types/mockdate" : " ^2.0.0" ,
50- "@types/node" : " ^10.11.1 " ,
50+ "@types/node" : " ^12.0.4 " ,
5151 "@types/uuid" : " ^3.4.4" ,
5252 "chai" : " ^4.2.0" ,
53- "jest" : " ^23.6 .0" ,
54- "jest-junit" : " ^5.1 .0" ,
53+ "jest" : " ^24.8 .0" ,
54+ "jest-junit" : " ^6.4 .0" ,
5555 "mockdate" : " ^2.0.2" ,
56- "prettier" : " ^1.14.3 " ,
57- "ts-jest" : " ^23.10.1 " ,
58- "ts-node" : " ^7.0.1 " ,
59- "tslint" : " ^5.11 .0" ,
60- "tslint-config-prettier" : " ^1.15 .0" ,
61- "typescript" : " ^3.0.3 "
56+ "prettier" : " ^1.17.1 " ,
57+ "ts-jest" : " ^24.0.2 " ,
58+ "ts-node" : " ^8.2.0 " ,
59+ "tslint" : " ^5.17 .0" ,
60+ "tslint-config-prettier" : " ^1.18 .0" ,
61+ "typescript" : " ^3.5.1 "
6262 },
6363 "dependencies" : {
64- "aws-sdk" : " ^2.323 .0" ,
65- "axios" : " ^0.18.1 " ,
66- "jest-diff" : " ^23.6 .0" ,
64+ "aws-sdk" : " ^2.469 .0" ,
65+ "axios" : " ^0.19.0 " ,
66+ "jest-diff" : " ^24.8 .0" ,
6767 "uuid" : " ^3.3.2"
6868 },
6969 "engines" : {
Original file line number Diff line number Diff line change 1+ import { Method } from 'axios' ;
12import chai = require( 'chai' ) ;
23import './' ;
34import api from './api' ;
@@ -13,7 +14,7 @@ chai.use(api);
1314describe ( 'api' , ( ) => {
1415 describe ( 'response' , ( ) => {
1516 const url = 'url' ;
16- const method = 'POST' ;
17+ const method = 'POST' as Method ;
1718 const params = { param1 : 'param1' } ;
1819 const data = { data1 : 'data1' } ;
1920 const headers = { header1 : 'header1' } ;
Original file line number Diff line number Diff line change 1+ import { Method } from 'axios' ;
12import { IPlainObject } from '../utils/api' ;
23
34export interface IApiProps {
4- method : string ;
5+ method : Method ;
56 url : string ;
67 params ?: IPlainObject ;
78 data ?: IPlainObject ;
Original file line number Diff line number Diff line change 1+ import { Method } from 'axios' ;
12import * as originalUtils from 'jest-matcher-utils' ;
23import { EOL } from 'os' ;
34import { toReturnResponse } from './api' ;
@@ -23,7 +24,7 @@ describe('api matchers', () => {
2324 } ,
2425 } ;
2526 const url = 'url' ;
26- const method = 'POST' ;
27+ const method = 'POST' as Method ;
2728 const params = { param1 : 'param1' } ;
2829 const data = { data1 : 'data1' } ;
2930 const headers = { header1 : 'header1' } ;
Original file line number Diff line number Diff line change 1- import axios from 'axios' ;
1+ import axios , { AxiosRequestConfig , Method } from 'axios' ;
22
33export interface IPlainObject extends Record < string , string > { }
44
55export const getResponse = async (
66 url : string ,
7- method : string ,
7+ method : Method ,
88 params ?: IPlainObject ,
99 data ?: IPlainObject ,
1010 headers ?: IPlainObject ,
1111) => {
12- const result = await axios ( {
12+ const config : AxiosRequestConfig = {
1313 data,
1414 headers,
1515 method,
1616 params,
1717 timeout : 30 * 1000 ,
1818 url,
1919 validateStatus : ( ) => true , // accept any status code
20- } ) ;
20+ } ;
21+
22+ const result = await axios ( config ) ;
2123 return { statusCode : result . status , data : result . data } ;
2224} ;
You can’t perform that action at this time.
0 commit comments