1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86const path = require('path')
const assert = require('assert')
const mocha = require('mocha')
const datfile = require('..')
const {describe, it} = mocha
describe('robloach-datfile', () => {
describe('test', () => {
const file = path.join(__dirname, 'test.dat')
it('should find the header information', done => {
datfile.parseFile(file).then(database => {
assert.strictEqual(database[0].name, 'Nintendo - Game Boy')
done()
}).catch(error => {
done(error)
})
})
})
describe('test2', () => {
const test2 = path.join(__dirname, 'test2.dat')
it('should find game header information', done => {
datfile.parseFile(test2).then(database => {
assert.strictEqual(database[1].name, 'sfinx')
done()
}).catch(error => {
done(error)
})
})
})
describe('test3', () => {
const test3 = path.join(__dirname, 'test3.dat')
it('should find game crc information', done => {
datfile.parseFile(test3).then(database => {
assert.strictEqual(database[1].entries[0].crc, '8f7abb81')
done()
}).catch(error => {
done(error)
})
})
})
describe('test4', () => {
const test4 = path.join(__dirname, 'test4.dat')
it('should find game crc information', done => {
const options = {
ignoreHeader: true,
}
datfile.parseFile(test4, options).then(database => {
assert.strictEqual(database[0].entries[0].name, 'dinothawr.game')
done()
}).catch(error => {
done(error)
})
})
})
describe('doublespace', () => {
const doublespace = path.join(__dirname, 'doublespace.dat')
it('should find game crc information', done => {
const options = {
ignoreHeader: true,
}
datfile.parseFile(doublespace, options).then(database => {
assert.strictEqual(database[2].entries[1].crc, '026e1651')
done()
}).catch(error => {
done(error)
})
})
})
describe('serial', () => {
const serial = path.join(__dirname, 'serial.dat')
it('should find game serial information', done => {
const options = {
ignoreHeader: true,
}
datfile.parseFile(serial, options).then(database => {
assert.strictEqual(database[0].entries[0].name, '007 Shitou - The Duel (Japan) (En).md')
assert.strictEqual(database[0].entries[0].serial, 'T-48073-00')
done()
}).catch(error => {
done(error)
})
})
})
})