@@ -2,6 +2,7 @@ import type DAT from '../../../src/models/dats/dat.js';
22import Game from '../../../src/models/dats/game.js' ;
33import Header from '../../../src/models/dats/logiqx/header.js' ;
44import LogiqxDAT from '../../../src/models/dats/logiqx/logiqxDat.js' ;
5+ import MameDAT from '../../../src/models/dats/mame/mameDat.js' ;
56import DATCombiner from '../../../src/modules/dats/datCombiner.js' ;
67import ProgressBarFake from '../../console/progressBarFake.js' ;
78
@@ -41,3 +42,31 @@ test.each([[1], [10], [100]])('should combine with any number of DATs: %s', (dat
4142 . toSorted ( ) ,
4243 ) . toEqual ( [ ...expectedGameNames ] . toSorted ( ) ) ;
4344} ) ;
45+
46+ test ( 'should not be MAME when no source DAT is MAME' , ( ) => {
47+ const dats = generateDummyDats ( 3 ) ;
48+ const combinedDat = new DATCombiner ( new ProgressBarFake ( ) ) . combine ( dats ) ;
49+
50+ expect ( combinedDat . isMame ( ) ) . toEqual ( false ) ;
51+ } ) ;
52+
53+ test ( 'should be MAME when any source DAT is MAME' , ( ) => {
54+ const dats : DAT [ ] = [
55+ new LogiqxDAT ( {
56+ header : new Header ( { name : 'Logiqx' } ) ,
57+ games : [ new Game ( { name : 'Logiqx Game' } ) ] ,
58+ } ) ,
59+ new MameDAT ( {
60+ machine : [ new Game ( { name : 'MAME Machine' } ) ] ,
61+ } ) ,
62+ ] ;
63+ const combinedDat = new DATCombiner ( new ProgressBarFake ( ) ) . combine ( dats ) ;
64+
65+ expect ( combinedDat . isMame ( ) ) . toEqual ( true ) ;
66+ expect (
67+ combinedDat
68+ . getGames ( )
69+ . map ( ( game ) => game . getName ( ) )
70+ . toSorted ( ) ,
71+ ) . toEqual ( [ 'Logiqx Game' , 'MAME Machine' ] ) ;
72+ } ) ;
0 commit comments