11/**
22 * Legacy API 测试套件
3- *
3+ *
44 * 测试所有旧版 API 的行为:
55 * 1. 旧 API 是否正常工作
66 * 2. 是否发出废弃警告
77 * 3. 参数转换是否正确
88 */
99
10- import { Sandbox } from '../../../src/sandbox/sandbox' ;
1110import { SandboxState } from '../../../src/sandbox/model' ;
11+ import { Sandbox } from '../../../src/sandbox/sandbox' ;
1212import { Config } from '../../../src/utils/config' ;
1313import { logger } from '../../../src/utils/log' ;
1414
@@ -61,7 +61,7 @@ describe('Legacy API Tests', () => {
6161 // Call legacy API
6262 const result = await Sandbox . create (
6363 { templateName : 'test-template' } ,
64- new Config ( { accessKeyId : 'test' } )
64+ new Config ( { accessKeyId : 'test' } ) ,
6565 ) ;
6666
6767 expect ( result ) . toBe ( mockSandbox ) ;
@@ -78,7 +78,9 @@ describe('Legacy API Tests', () => {
7878 await Sandbox . create ( { templateName : 'test' } , undefined ) ;
7979
8080 expect ( warnSpy ) . toHaveBeenCalledWith (
81- expect . stringContaining ( 'Deprecated: Sandbox.create(input, config) is deprecated' )
81+ expect . stringContaining (
82+ 'Deprecated: Sandbox.create(input, config) is deprecated' ,
83+ ) ,
8284 ) ;
8385 } ) ;
8486
@@ -106,7 +108,7 @@ describe('Legacy API Tests', () => {
106108 // Call legacy API
107109 const result = await Sandbox . delete (
108110 'test-sandbox' ,
109- new Config ( { accessKeyId : 'test' } )
111+ new Config ( { accessKeyId : 'test' } ) ,
110112 ) ;
111113
112114 expect ( result ) . toBe ( mockSandbox ) ;
@@ -120,7 +122,7 @@ describe('Legacy API Tests', () => {
120122 await Sandbox . delete ( 'test-sandbox' , undefined ) ;
121123
122124 expect ( warnSpy ) . toHaveBeenCalledWith (
123- expect . stringContaining ( 'Sandbox.delete(id, config) is deprecated' )
125+ expect . stringContaining ( 'Sandbox.delete(id, config) is deprecated' ) ,
124126 ) ;
125127 } ) ;
126128
@@ -147,7 +149,7 @@ describe('Legacy API Tests', () => {
147149 // Call legacy API
148150 const result = await Sandbox . stop (
149151 'test-sandbox' ,
150- new Config ( { accessKeyId : 'test' } )
152+ new Config ( { accessKeyId : 'test' } ) ,
151153 ) ;
152154
153155 expect ( result ) . toBe ( mockSandbox ) ;
@@ -161,7 +163,7 @@ describe('Legacy API Tests', () => {
161163 await Sandbox . stop ( 'test-sandbox' , undefined ) ;
162164
163165 expect ( warnSpy ) . toHaveBeenCalledWith (
164- expect . stringContaining ( 'Sandbox.stop(id, config) is deprecated' )
166+ expect . stringContaining ( 'Sandbox.stop(id, config) is deprecated' ) ,
165167 ) ;
166168 } ) ;
167169
@@ -188,7 +190,7 @@ describe('Legacy API Tests', () => {
188190 // Call legacy API
189191 const result = await Sandbox . list (
190192 { maxResults : 10 } ,
191- new Config ( { accessKeyId : 'test' } )
193+ new Config ( { accessKeyId : 'test' } ) ,
192194 ) ;
193195
194196 expect ( result ) . toEqual ( mockSandboxes ) ;
@@ -201,7 +203,7 @@ describe('Legacy API Tests', () => {
201203 await Sandbox . list ( { maxResults : 10 } , undefined ) ;
202204
203205 expect ( warnSpy ) . toHaveBeenCalledWith (
204- expect . stringContaining ( 'Sandbox.list(input, config) is deprecated' )
206+ expect . stringContaining ( 'Sandbox.list(input, config) is deprecated' ) ,
205207 ) ;
206208 } ) ;
207209
@@ -216,14 +218,6 @@ describe('Legacy API Tests', () => {
216218 expect ( mockClientListSandboxes ) . toHaveBeenCalledWith ( input , config ) ;
217219 } ) ;
218220
219- it ( 'should detect legacy API when arg2 is present' , async ( ) => {
220- mockClientListSandboxes . mockResolvedValue ( [ ] ) ;
221-
222- await Sandbox . list ( undefined , new Config ( ) ) ;
223-
224- expect ( warnSpy ) . toHaveBeenCalled ( ) ;
225- } ) ;
226-
227221 it ( 'should detect legacy API when arg1 has list params' , async ( ) => {
228222 mockClientListSandboxes . mockResolvedValue ( [ ] ) ;
229223
0 commit comments