@@ -22,9 +22,10 @@ describe("k8sClient", () => {
2222 describe ( "createClient" , ( ) => {
2323 describe ( "all required options are provided" , ( ) => {
2424 const options = { apiEndpoint : "test" , token : "test" }
25+ const result = expect ( ( ) => createClient ( options ) )
2526
2627 test ( "should not throw an error" , ( ) => {
27- expect ( ( ) => createClient ( options ) ) . not . toThrow ( )
28+ result . not . toThrow ( )
2829 } )
2930
3031 test ( "should return a client object" , ( ) => {
@@ -59,16 +60,18 @@ describe("Client", () => {
5960 expect ( client . get ) . toBeDefined ( )
6061 } )
6162
62- test ( "call request" , ( ) => {
63- client . get ( "/api/v1" , { params : { key1 : "value1" , key2 : "value2" } } )
63+ test ( "call request" , async ( ) => {
64+ await client . get ( "/api/v1" , { params : { key1 : "value1" , key2 : "value2" } } )
6465 expect ( request ) . toHaveBeenLastCalledWith ( "GET" , "https://test.com/api/v1" , {
66+ // linter complains of the asymmetric matcher "expect.anything()" - unsafe 'any' value assignment
67+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6568 headers : expect . anything ( ) ,
6669 params : { key1 : "value1" , key2 : "value2" } ,
6770 } )
6871 } )
6972
70- test ( "allow to override default options" , ( ) => {
71- client . get ( "/api/v1" , {
73+ test ( "allow to override default options" , async ( ) => {
74+ await client . get ( "/api/v1" , {
7275 headers : { Authorization : "test" , "Content-Type" : "text" } ,
7376 } )
7477 expect ( request ) . toHaveBeenLastCalledWith ( "GET" , "https://test.com/api/v1" , {
@@ -82,9 +85,11 @@ describe("Client", () => {
8285 expect ( client . post ) . toBeDefined ( )
8386 } )
8487
85- test ( "call request" , ( ) => {
86- client . post ( "/api/v1" , { key1 : "value1" } , { params : { key1 : "value1" , key2 : "value2" } } )
88+ test ( "call request" , async ( ) => {
89+ await client . post ( "/api/v1" , { key1 : "value1" } , { params : { key1 : "value1" , key2 : "value2" } } )
8790 expect ( request ) . toHaveBeenLastCalledWith ( "POST" , "https://test.com/api/v1" , {
91+ // linter complains of the asymmetric matcher "expect.anything()" - unsafe 'any' value assignment
92+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
8893 headers : expect . anything ( ) ,
8994 params : { key1 : "value1" , key2 : "value2" } ,
9095 body : { key1 : "value1" } ,
@@ -97,8 +102,8 @@ describe("Client", () => {
97102 expect ( client . put ) . toBeDefined ( )
98103 } )
99104
100- test ( "call request" , ( ) => {
101- client . put ( "/api/v1" , { key1 : "value1" } , { params : { key1 : "value1" , key2 : "value2" } } )
105+ test ( "call request" , async ( ) => {
106+ await client . put ( "/api/v1" , { key1 : "value1" } , { params : { key1 : "value1" , key2 : "value2" } } )
102107 expect ( request ) . toHaveBeenLastCalledWith ( "PUT" , "https://test.com/api/v1" , {
103108 headers : {
104109 Authorization : "Bearer test" ,
@@ -115,8 +120,8 @@ describe("Client", () => {
115120 expect ( client . patch ) . toBeDefined ( )
116121 } )
117122
118- test ( "call request" , ( ) => {
119- client . patch (
123+ test ( "call request" , async ( ) => {
124+ await client . patch (
120125 "/api/v1" ,
121126 { key1 : "value1" } ,
122127 {
@@ -139,11 +144,13 @@ describe("Client", () => {
139144 expect ( client . delete ) . toBeDefined ( )
140145 } )
141146
142- test ( "call request" , ( ) => {
143- client . delete ( "/api/v1" , null , {
147+ test ( "call request" , async ( ) => {
148+ await client . delete ( "/api/v1" , null , {
144149 params : { key1 : "value1" , key2 : "value2" } ,
145150 } )
146151 expect ( request ) . toHaveBeenLastCalledWith ( "DELETE" , "https://test.com/api/v1" , {
152+ // linter complains of the asymmetric matcher "expect.anything()" - unsafe 'any' value assignment
153+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
147154 headers : expect . anything ( ) ,
148155 body : null ,
149156 params : { key1 : "value1" , key2 : "value2" } ,
@@ -156,9 +163,11 @@ describe("Client", () => {
156163 expect ( client . head ) . toBeDefined ( )
157164 } )
158165
159- test ( "call request" , ( ) => {
160- client . head ( "/api/v1" , { params : { key1 : "value1" , key2 : "value2" } } )
166+ test ( "call request" , async ( ) => {
167+ await client . head ( "/api/v1" , { params : { key1 : "value1" , key2 : "value2" } } )
161168 expect ( request ) . toHaveBeenLastCalledWith ( "HEAD" , "https://test.com/api/v1" , {
169+ // linter complains of the asymmetric matcher "expect.anything()" - unsafe 'any' value assignment
170+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
162171 headers : expect . anything ( ) ,
163172 params : { key1 : "value1" , key2 : "value2" } ,
164173 } )
0 commit comments