File tree Expand file tree Collapse file tree 7 files changed +15
-8
lines changed Expand file tree Collapse file tree 7 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export default {
56
56
}
57
57
}
58
58
59
- const metadata = [ ...output . matchAll ( / m e t a d a t a : + ( .+ ) \n + ( .+ ) / gi) ]
59
+ const metadata = [ ...output . matchAll ( / m e t a d a t a : + ( .+ ) \r ? \ n + ( .+ ) / gi) ]
60
60
. map ( ( match , index_ ) => {
61
61
const tag = match [ 1 ] . match ( / t a g = ' ( [ \d a - z ] + ) ' / i) ?. at ( 1 ) ?. trim ( ) ?? '' ;
62
62
const index = Number . parseInt (
@@ -76,7 +76,7 @@ export default {
76
76
} ) ;
77
77
78
78
const metadataTags = new Set ( metadata . map ( ( m ) => m . tag ) ) ;
79
- let type = CHDType . UNKNOWN ;
79
+ let type = CHDType . RAW ;
80
80
if ( metadataTags . has ( 'GDDD' ) ) {
81
81
type = CHDType . HARD_DISK ;
82
82
} else if ( metadataTags . has ( 'CHCD' ) || metadataTags . has ( 'CHTR' ) || metadataTags . has ( 'CHT2' ) ) {
Original file line number Diff line number Diff line change @@ -19,5 +19,4 @@ export enum CHDType {
19
19
GD_ROM ,
20
20
DVD_ROM ,
21
21
// LASER_DISC,
22
- UNKNOWN ,
23
22
}
Original file line number Diff line number Diff line change 1
1
import ChdmanBin from '../../src/chdman/chdmanBin.js' ;
2
2
3
- test ( 'should print the help message' , async ( ) => {
3
+ it ( 'should print the help message' , async ( ) => {
4
4
try {
5
5
await ChdmanBin . run ( [ 'help' ] ) ;
6
6
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ import fs from 'node:fs';
5
5
import ChdmanCd from '../../src/chdman/chdmanCd.js' ;
6
6
import ChdmanInfo from '../../src/chdman/chdmanInfo.js' ;
7
7
import TestUtil from '../testUtil.js' ;
8
+ import { CHDType } from '../../src/chdman/common.js' ;
8
9
9
- test ( 'should fail on nonexistent file' , async ( ) => {
10
+ it ( 'should fail on nonexistent file' , async ( ) => {
10
11
const temporaryChd = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .chd` ;
11
12
const temporaryCue = `${ temporaryChd } .cue` ;
12
13
const temporaryBin = `${ temporaryChd } .bin` ;
@@ -60,6 +61,7 @@ test.each([
60
61
expect ( info . ratio ) . toBeGreaterThan ( 0 ) ;
61
62
expect ( info . sha1 ) . toBeTruthy ( ) ;
62
63
expect ( info . dataSha1 ) . toBeTruthy ( ) ;
64
+ expect ( info . type ) . toEqual ( CHDType . CD_ROM ) ;
63
65
64
66
await ChdmanCd . extractCd ( {
65
67
inputFilename : temporaryChd ,
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ import crypto from 'node:crypto';
6
6
import ChdmanInfo from '../../src/chdman/chdmanInfo.js' ;
7
7
import TestUtil from '../testUtil.js' ;
8
8
import ChdmanDvd from '../../src/chdman/chdmanDvd.js' ;
9
+ import { CHDType } from '../../src/chdman/common.js' ;
9
10
10
11
// https://unix.stackexchange.com/a/33634
11
12
12
- test ( 'should fail on nonexistent file' , async ( ) => {
13
+ it ( 'should fail on nonexistent file' , async ( ) => {
13
14
const temporaryChd = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .chd` ;
14
15
const temporaryIso = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .iso` ;
15
16
@@ -58,6 +59,7 @@ test.each([
58
59
expect ( info . ratio ) . toBeGreaterThan ( 0 ) ;
59
60
expect ( info . sha1 ) . toBeTruthy ( ) ;
60
61
expect ( info . dataSha1 ) . toBeTruthy ( ) ;
62
+ expect ( info . type ) . toEqual ( CHDType . DVD_ROM ) ;
61
63
62
64
await ChdmanDvd . extractDvd ( {
63
65
inputFilename : temporaryChd ,
Original file line number Diff line number Diff line change @@ -5,10 +5,11 @@ import fs from 'node:fs';
5
5
import ChdmanHd from '../../src/chdman/chdmanHd.js' ;
6
6
import ChdmanInfo from '../../src/chdman/chdmanInfo.js' ;
7
7
import TestUtil from '../testUtil.js' ;
8
+ import { CHDType } from '../../src/chdman/common.js' ;
8
9
9
10
// https://unix.stackexchange.com/a/33634
10
11
11
- test ( 'should fail on nonexistent file' , async ( ) => {
12
+ it ( 'should fail on nonexistent file' , async ( ) => {
12
13
const temporaryChd = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .chd` ;
13
14
const temporaryHd = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .hd` ;
14
15
@@ -60,6 +61,7 @@ test.each([
60
61
expect ( info . ratio ) . toBeGreaterThan ( 0 ) ;
61
62
expect ( info . sha1 ) . toBeTruthy ( ) ;
62
63
expect ( info . dataSha1 ) . toBeTruthy ( ) ;
64
+ expect ( info . type ) . toEqual ( CHDType . HARD_DISK ) ;
63
65
64
66
await ChdmanHd . extractHd ( {
65
67
inputFilename : temporaryChd ,
Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ import fs from 'node:fs';
5
5
import ChdmanInfo from '../../src/chdman/chdmanInfo.js' ;
6
6
import TestUtil from '../testUtil.js' ;
7
7
import ChdmanRaw from '../../src/chdman/chdmanRaw.js' ;
8
+ import { CHDType } from '../../src/chdman/common.js' ;
8
9
9
- test ( 'should fail on nonexistent file' , async ( ) => {
10
+ it ( 'should fail on nonexistent file' , async ( ) => {
10
11
const temporaryChd = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .chd` ;
11
12
const temporaryRaw = `${ await TestUtil . mktemp ( path . join ( os . tmpdir ( ) , 'dummy' ) ) } .hd` ;
12
13
@@ -61,6 +62,7 @@ test.each([
61
62
expect ( info . ratio ) . toBeGreaterThan ( 0 ) ;
62
63
expect ( info . sha1 ) . toBeTruthy ( ) ;
63
64
expect ( info . dataSha1 ) . toBeTruthy ( ) ;
65
+ expect ( info . type ) . toEqual ( CHDType . RAW ) ;
64
66
65
67
await ChdmanRaw . extractRaw ( {
66
68
inputFilename : temporaryChd ,
You can’t perform that action at this time.
0 commit comments