@@ -42,20 +42,24 @@ describe('AuthClient', () => {
42
42
}
43
43
} ) ;
44
44
45
- describe ( 'shared auth interceptor ' , ( ) => {
46
- it ( 'should use the default interceptor ' , ( ) => {
45
+ describe ( 'shared auth interceptors ' , ( ) => {
46
+ it ( 'should use the default interceptors ' , ( ) => {
47
47
const gaxios = new Gaxios ( ) ;
48
48
49
49
new PassThroughClient ( { transporter : gaxios } ) ;
50
50
51
51
assert (
52
52
gaxios . interceptors . request . has ( AuthClient . DEFAULT_REQUEST_INTERCEPTOR ) ,
53
53
) ;
54
+ assert (
55
+ gaxios . interceptors . response . has ( AuthClient . DEFAULT_RESPONSE_INTERCEPTOR ) ,
56
+ ) ;
54
57
} ) ;
55
58
56
59
it ( 'should allow disabling of the default interceptor' , ( ) => {
57
60
const gaxios = new Gaxios ( ) ;
58
- const originalInterceptorCount = gaxios . interceptors . request . size ;
61
+ const originalRequestInterceptorCount = gaxios . interceptors . request . size ;
62
+ const originalResponseInterceptorCount = gaxios . interceptors . response . size ;
59
63
60
64
const authClient = new PassThroughClient ( {
61
65
transporter : gaxios ,
@@ -65,19 +69,26 @@ describe('AuthClient', () => {
65
69
assert . equal ( authClient . transporter , gaxios ) ;
66
70
assert . equal (
67
71
authClient . transporter . interceptors . request . size ,
68
- originalInterceptorCount ,
72
+ originalRequestInterceptorCount ,
73
+ ) ;
74
+ assert . equal (
75
+ authClient . transporter . interceptors . response . size ,
76
+ originalResponseInterceptorCount ,
69
77
) ;
70
78
} ) ;
71
79
72
80
it ( 'should add the default interceptor exactly once between instances' , ( ) => {
73
81
const gaxios = new Gaxios ( ) ;
74
- const originalInterceptorCount = gaxios . interceptors . request . size ;
75
- const expectedInterceptorCount = originalInterceptorCount + 1 ;
82
+ const originalRequestInterceptorCount = gaxios . interceptors . request . size ;
83
+ const expectedRequestInterceptorCount = originalRequestInterceptorCount + 1 ;
84
+ const originalResponseInterceptorCount = gaxios . interceptors . response . size ;
85
+ const expectedResponseInterceptorCount = originalResponseInterceptorCount + 1 ;
76
86
77
87
new PassThroughClient ( { transporter : gaxios } ) ;
78
88
new PassThroughClient ( { transporter : gaxios } ) ;
79
89
80
- assert . equal ( gaxios . interceptors . request . size , expectedInterceptorCount ) ;
90
+ assert . equal ( gaxios . interceptors . request . size , expectedRequestInterceptorCount ) ;
91
+ assert . equal ( gaxios . interceptors . response . size , expectedResponseInterceptorCount ) ;
81
92
} ) ;
82
93
83
94
describe ( 'User-Agent' , ( ) => {
0 commit comments