@@ -122,6 +122,15 @@ vi.spyOn(service, 'myMethod').and.unknownStrategy();`,
122122 methodB: vi.fn().mockName("MyService.methodB"),
123123 };` ,
124124 } ,
125+ {
126+ description :
127+ 'should transform jasmine.createSpyObj with an array of methods without base name' ,
128+ input : `const myService = jasmine.createSpyObj(['methodA', 'methodB']);` ,
129+ expected : `const myService = {
130+ methodA: vi.fn(),
131+ methodB: vi.fn(),
132+ };` ,
133+ } ,
125134 {
126135 description : 'should add a TODO if the second argument is not a literal' ,
127136 input : `const myService = jasmine.createSpyObj('MyService', methodNames);` ,
@@ -138,6 +147,15 @@ vi.spyOn(service, 'myMethod').and.unknownStrategy();`,
138147 methodB: vi.fn().mockName("MyService.methodB").mockReturnValue(42),
139148 };` ,
140149 } ,
150+ {
151+ description :
152+ 'should transform jasmine.createSpyObj with an object of return values without base name' ,
153+ input : `const myService = jasmine.createSpyObj({ methodA: 'foo', methodB: 42 });` ,
154+ expected : `const myService = {
155+ methodA: vi.fn().mockReturnValue('foo'),
156+ methodB: vi.fn().mockReturnValue(42),
157+ };` ,
158+ } ,
141159 {
142160 description :
143161 'should transform jasmine.createSpyObj with an object of return values containing an asymmetric matcher' ,
@@ -147,7 +165,7 @@ vi.spyOn(service, 'myMethod').and.unknownStrategy();`,
147165 };` ,
148166 } ,
149167 {
150- description : 'should add a TODO for jasmine.createSpyObj with only one argument' ,
168+ description : 'should add a TODO for jasmine.createSpyObj with only base name argument' ,
151169 input : `const myService = jasmine.createSpyObj('MyService');` ,
152170 expected : `
153171 // TODO: vitest-migration: jasmine.createSpyObj called with a single argument is not supported for transformation. See: https://vitest.dev/api/vi.html#vi-fn
@@ -170,6 +188,15 @@ vi.spyOn(service, 'myMethod').and.unknownStrategy();`,
170188 propA: 'valueA',
171189 };` ,
172190 } ,
191+ {
192+ description :
193+ 'should transform jasmine.createSpyObj with a method map and a property map without base name' ,
194+ input : `const myService = jasmine.createSpyObj({ methodA: 'foo' }, { propA: 'valueA' });` ,
195+ expected : `const myService = {
196+ methodA: vi.fn().mockReturnValue('foo'),
197+ propA: 'valueA',
198+ };` ,
199+ } ,
173200 {
174201 description : 'should ignore non-string literals in the method array' ,
175202 input : `const myService = jasmine.createSpyObj('MyService', ['methodA', 123, someVar]);` ,
0 commit comments