@@ -92,7 +92,7 @@ describe('runCodegen', () => {
9292 expect ( mockGenerateKotlin ) . not . toHaveBeenCalled ( ) ;
9393 } ) ;
9494
95- it ( 'generates kotlin files for discovered store ' , async ( ) => {
95+ it ( 'generates kotlin files when platform is kotlin ' , async ( ) => {
9696 tempDir = createTempPackageJson ( {
9797 brownie : {
9898 kotlin : './Generated' ,
@@ -101,7 +101,7 @@ describe('runCodegen', () => {
101101 } ) ;
102102 mockCwd . mockReturnValue ( tempDir ) ;
103103
104- await runCodegen ( { } ) ;
104+ await runCodegen ( { platform : 'kotlin' } ) ;
105105
106106 expect ( mockGenerateKotlin ) . toHaveBeenCalledWith ( {
107107 name : 'TestStore' ,
@@ -110,10 +110,10 @@ describe('runCodegen', () => {
110110 outputPath : 'Generated/TestStore.kt' ,
111111 packageName : 'com.test' ,
112112 } ) ;
113- expect ( mockGenerateSwift ) . toHaveBeenCalled ( ) ;
113+ expect ( mockGenerateSwift ) . not . toHaveBeenCalled ( ) ;
114114 } ) ;
115115
116- it ( 'generates both swift and kotlin when configured' , async ( ) => {
116+ it ( 'generates only swift by default even when kotlin is configured' , async ( ) => {
117117 tempDir = createTempPackageJson ( {
118118 brownie : {
119119 kotlin : './Generated' ,
@@ -124,7 +124,7 @@ describe('runCodegen', () => {
124124 await runCodegen ( { } ) ;
125125
126126 expect ( mockGenerateSwift ) . toHaveBeenCalled ( ) ;
127- expect ( mockGenerateKotlin ) . toHaveBeenCalled ( ) ;
127+ expect ( mockGenerateKotlin ) . not . toHaveBeenCalled ( ) ;
128128 } ) ;
129129
130130 it ( 'generates only specified platform' , async ( ) => {
@@ -172,19 +172,6 @@ describe('runCodegen', () => {
172172 } ) ;
173173 } ) ;
174174
175- it ( 'exits with error for invalid platform' , async ( ) => {
176- tempDir = createTempPackageJson ( {
177- brownie : { } ,
178- } ) ;
179- mockCwd . mockReturnValue ( tempDir ) ;
180-
181- // @ts -expect-error - testing invalid input
182- await expect ( runCodegen ( { platform : 'invalid' } ) ) . rejects . toThrow (
183- 'process.exit(1)'
184- ) ;
185- expect ( mockLoggerError ) . toHaveBeenCalled ( ) ;
186- } ) ;
187-
188175 it ( 'exits with error when generator fails' , async ( ) => {
189176 tempDir = createTempPackageJson ( {
190177 brownie : { } ,
@@ -206,4 +193,13 @@ describe('runCodegen', () => {
206193
207194 expect ( mockGenerateKotlin ) . not . toHaveBeenCalled ( ) ;
208195 } ) ;
196+
197+ it ( 'works without brownie config in package.json' , async ( ) => {
198+ tempDir = createTempPackageJson ( { } ) ;
199+ mockCwd . mockReturnValue ( tempDir ) ;
200+
201+ await runCodegen ( { } ) ;
202+
203+ expect ( mockGenerateSwift ) . toHaveBeenCalled ( ) ;
204+ } ) ;
209205} ) ;
0 commit comments