@@ -11,7 +11,6 @@ const encryption = require('../../../../lib/cloud/encryption')
11
11
12
12
const {
13
13
agent,
14
- CombinedAgent,
15
14
} = require ( '@packages/network' )
16
15
const pkg = require ( '@packages/root' )
17
16
const api = require ( '../../../../lib/cloud/api' ) . default
@@ -141,10 +140,7 @@ describe('lib/cloud/api', () => {
141
140
142
141
context ( '.rp' , ( ) => {
143
142
beforeEach ( ( ) => {
144
- // Because @packages /network is a bundled ES6 class with https://github.com/cypress-io/cypress/pull/32633
145
- // we can no longer mock the addRequest method on the agent singleton instance directly
146
- // Until we are able to convert this test to Vitest/TypeScript, we need to spy on the prototype
147
- sinon . spy ( CombinedAgent . prototype , 'addRequest' )
143
+ sinon . spy ( agent , 'addRequest' )
148
144
149
145
return nock . enableNetConnect ( )
150
146
} ) // nock will prevent requests from reaching the agent
@@ -155,9 +151,9 @@ describe('lib/cloud/api', () => {
155
151
return api . ping ( )
156
152
. thenThrow ( )
157
153
. catch ( ( ) => {
158
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledOnce
154
+ expect ( agent . addRequest ) . to . be . calledOnce
159
155
160
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
156
+ expect ( agent . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
161
157
href : 'http://localhost:1234/ping' ,
162
158
} )
163
159
} )
@@ -169,9 +165,9 @@ describe('lib/cloud/api', () => {
169
165
return api . ping ( )
170
166
. thenThrow ( )
171
167
. catch ( ( ) => {
172
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledOnce
168
+ expect ( agent . addRequest ) . to . be . calledOnce
173
169
174
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
170
+ expect ( agent . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
175
171
rejectUnauthorized : true ,
176
172
} )
177
173
} )
@@ -189,9 +185,9 @@ describe('lib/cloud/api', () => {
189
185
return api . ping ( )
190
186
. thenThrow ( )
191
187
. catch ( ( ) => {
192
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledOnce
188
+ expect ( agent . addRequest ) . to . be . calledOnce
193
189
194
- expect ( CombinedAgent . prototype . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
190
+ expect ( agent . addRequest ) . to . be . calledWithMatch ( sinon . match . any , {
195
191
href : 'http://localhost:1234/ping' ,
196
192
} )
197
193
} )
0 commit comments