@@ -5,7 +5,7 @@ import { getCacheManager } from '../../src/cache/cache-manager.js';
55import { verifyJavaVersion } from '../../src/java/java-process.js' ;
66import { getDecompileService } from '../../src/services/decompile-service.js' ;
77import { getRemapService } from '../../src/services/remap-service.js' ;
8- import { TEST_MAPPING , TEST_VERSION } from '../test-constants.js' ;
8+ import { TEST_MAPPING , TEST_VERSION , UNOBFUSCATED_TEST_VERSION } from '../test-constants.js' ;
99
1010/**
1111 * JAR Remapping Tests
@@ -279,7 +279,7 @@ describe('JAR Remapping', () => {
279279 const source = await decompileService . getClassSource (
280280 TEST_VERSION ,
281281 'net.minecraft.world.entity.Entity' ,
282- 'mojmap'
282+ 'mojmap' ,
283283 ) ;
284284
285285 expect ( source ) . toBeDefined ( ) ;
@@ -301,7 +301,7 @@ describe('JAR Remapping', () => {
301301 const source = await decompileService . getClassSource (
302302 TEST_VERSION ,
303303 'net.minecraft.world.entity.Entity' ,
304- 'mojmap'
304+ 'mojmap' ,
305305 ) ;
306306
307307 expect ( source ) . toBeDefined ( ) ;
@@ -318,7 +318,7 @@ describe('JAR Remapping', () => {
318318 const source = await decompileService . getClassSource (
319319 TEST_VERSION ,
320320 'net.minecraft.server.MinecraftServer' ,
321- 'mojmap'
321+ 'mojmap' ,
322322 ) ;
323323
324324 expect ( source ) . toBeDefined ( ) ;
@@ -342,7 +342,7 @@ describe('JAR Remapping', () => {
342342 const source = await decompileService . getClassSource (
343343 TEST_VERSION ,
344344 'net.minecraft.entity.Entity' ,
345- 'yarn'
345+ 'yarn' ,
346346 ) ;
347347
348348 expect ( source ) . toBeDefined ( ) ;
@@ -361,7 +361,7 @@ describe('JAR Remapping', () => {
361361 const source = await decompileService . getClassSource (
362362 TEST_VERSION ,
363363 'net.minecraft.entity.Entity' ,
364- 'yarn'
364+ 'yarn' ,
365365 ) ;
366366
367367 expect ( source ) . toBeDefined ( ) ;
@@ -374,4 +374,30 @@ describe('JAR Remapping', () => {
374374 expect ( intermediaryFieldCount ) . toBeLessThan ( 20 ) ;
375375 } , 60000 ) ;
376376 } ) ;
377+
378+ describe ( 'Unobfuscated version handling' , ( ) => {
379+ // 26.1+ snapshots ship without obfuscation - no intermediary or Yarn mappings exist.
380+ it ( 'should throw a clear error when requesting yarn mappings for an unobfuscated version' , async ( ) => {
381+ const remapService = getRemapService ( ) ;
382+ await expect ( remapService . getRemappedJar ( UNOBFUSCATED_TEST_VERSION , 'yarn' ) ) . rejects . toThrow (
383+ / y a r n m a p p i n g s a r e n o t s u p p o r t e d f o r u n o b f u s c a t e d / i,
384+ ) ;
385+ } , 60000 ) ; // network call to fetch version JSON on first run
386+
387+ it ( 'should throw a clear error when requesting intermediary mappings for an unobfuscated version' , async ( ) => {
388+ const remapService = getRemapService ( ) ;
389+ await expect (
390+ remapService . getRemappedJar ( UNOBFUSCATED_TEST_VERSION , 'intermediary' ) ,
391+ ) . rejects . toThrow ( / i n t e r m e d i a r y m a p p i n g s a r e n o t s u p p o r t e d f o r u n o b f u s c a t e d / i) ;
392+ } , 60000 ) ;
393+
394+ it ( 'should return the raw client JAR for mojmap on an unobfuscated version' , async ( ) => {
395+ const remapService = getRemapService ( ) ;
396+ const jarPath = await remapService . getRemappedJar ( UNOBFUSCATED_TEST_VERSION , 'mojmap' ) ;
397+ expect ( jarPath ) . toBeDefined ( ) ;
398+ expect ( existsSync ( jarPath ) ) . toBe ( true ) ;
399+ // The returned path is the raw client JAR, not a remapped copy
400+ expect ( jarPath ) . not . toContain ( 'remapped' ) ;
401+ } , 60000 ) ;
402+ } ) ;
377403} ) ;
0 commit comments