@@ -195,21 +195,37 @@ describe('Generate with version mismatch', () => {
195195 } )
196196} )
197197
198- describe ( 'extractExactVersion' , ( ) => {
199- // Note: extractExactVersion is internal to version-mismatch-checker.ts
200- // We test it indirectly through getLocalPrismaVersion
201-
202- it ( 'should handle caret version specifier' , async ( ) => {
203- // This test verifies that version specifiers like ^5.0.0 are properly handled
204- // The actual extraction logic is tested in version-mismatch-checker.test.ts
205- expect ( true ) . toBe ( true ) // Placeholder - actual testing in module tests
198+ describe ( 'version specifier normalization' , ( ) => {
199+ const optionsFor = ( clientVersion : string | null ) : VersionMismatchOptions => ( {
200+ isGlobalInstall : ( ) => 'npm' ,
201+ getClientVersion : ( ) => Promise . resolve ( clientVersion ) ,
202+ getLocalPrismaVersion : ( ) => Promise . resolve ( null ) ,
206203 } )
207204
208- it ( 'should handle tilde version specifier' , async ( ) => {
209- expect ( true ) . toBe ( true ) // Placeholder - actual testing in module tests
205+ it ( 'treats caret specifier as matching the same global version' , async ( ) => {
206+ const result = await checkVersionMismatch ( '5.0.0' , optionsFor ( '^5.0.0' ) )
207+ expect ( result ) . toBeNull ( )
210208 } )
211209
212- it ( 'should handle exact version specifier' , async ( ) => {
213- expect ( true ) . toBe ( true ) // Placeholder - actual testing in module tests
210+ it ( 'treats tilde specifier as matching the same global version' , async ( ) => {
211+ const result = await checkVersionMismatch ( '5.0.0' , optionsFor ( '~5.0.0' ) )
212+ expect ( result ) . toBeNull ( )
213+ } )
214+
215+ it ( 'still reports mismatch for different exact versions' , async ( ) => {
216+ const result = await checkVersionMismatch ( '5.0.0' , optionsFor ( '4.0.0' ) )
217+ expect ( result ?. localPackageType ) . toBe ( '@prisma/client' )
218+ expect ( result ?. localVersion ) . toBe ( '4.0.0' )
219+ } )
220+
221+ it ( 'handles workspace:* specifier gracefully' , async ( ) => {
222+ // workspace:* should be normalized to null and not cause false warnings
223+ const result = await checkVersionMismatch ( '5.0.0' , optionsFor ( 'workspace:*' ) )
224+ expect ( result ) . toBeNull ( )
225+ } )
226+
227+ it ( 'handles >= specifier' , async ( ) => {
228+ const result = await checkVersionMismatch ( '5.0.0' , optionsFor ( '>=5.0.0' ) )
229+ expect ( result ) . toBeNull ( )
214230 } )
215231} )
0 commit comments