2022-05-31 15:38:40 +00:00
|
|
|
import { ENCODING_BITSTREAM } from 'js/formats/types';
|
2021-07-10 00:54:27 +00:00
|
|
|
import createDiskFromWoz from 'js/formats/woz';
|
|
|
|
import {
|
|
|
|
mockWoz1,
|
|
|
|
mockWoz2,
|
|
|
|
mockTMAP
|
|
|
|
} from './testdata/woz';
|
|
|
|
|
|
|
|
describe('woz', () => {
|
|
|
|
beforeEach(() => {
|
2021-10-02 14:21:37 +00:00
|
|
|
jest.spyOn(console, 'log').mockImplementation();
|
2021-07-10 00:54:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can parse Woz version 1', () => {
|
|
|
|
const options = {
|
|
|
|
name: 'Unknown',
|
|
|
|
volume: 254,
|
|
|
|
readOnly: true,
|
|
|
|
rawData: mockWoz1
|
|
|
|
};
|
|
|
|
|
2022-06-20 02:52:06 +00:00
|
|
|
const disk = createDiskFromWoz(options);
|
2021-07-10 00:54:27 +00:00
|
|
|
expect(disk).toEqual({
|
|
|
|
name: 'Mock Woz 1',
|
|
|
|
readOnly: true,
|
|
|
|
encoding: ENCODING_BITSTREAM,
|
|
|
|
trackMap: mockTMAP,
|
|
|
|
rawTracks: [new Uint8Array([
|
|
|
|
1, 1, 0, 1, 0, 1, 0, 1,
|
|
|
|
1, 0, 1, 0, 1, 0, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
])],
|
|
|
|
tracks: [new Uint8Array([0xD5, 0xAA, 0x96])],
|
2022-06-20 02:52:06 +00:00
|
|
|
info: {
|
2021-07-10 00:54:27 +00:00
|
|
|
bitTiming: 0,
|
|
|
|
bootSector: 0,
|
|
|
|
cleaned: 0,
|
|
|
|
compatibleHardware: 0,
|
|
|
|
creator: 'Apple2JS ',
|
|
|
|
diskType: 1,
|
|
|
|
largestTrack: 0,
|
|
|
|
requiredRAM: 0,
|
|
|
|
sides: 0,
|
|
|
|
synchronized: 1,
|
|
|
|
version: 1,
|
|
|
|
writeProtected: 0
|
|
|
|
}
|
2022-06-20 02:52:06 +00:00
|
|
|
});
|
2021-07-10 00:54:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can parse Woz version 2', () => {
|
|
|
|
const options = {
|
|
|
|
name: 'Unknown',
|
|
|
|
volume: 254,
|
|
|
|
readOnly: true,
|
|
|
|
rawData: mockWoz2
|
|
|
|
};
|
|
|
|
|
2022-06-20 02:52:06 +00:00
|
|
|
const disk = createDiskFromWoz(options);
|
2021-07-10 00:54:27 +00:00
|
|
|
expect(disk).toEqual({
|
|
|
|
name: 'Mock Woz 2',
|
2021-10-02 18:45:09 +00:00
|
|
|
side: 'B',
|
2021-07-10 00:54:27 +00:00
|
|
|
readOnly: true,
|
|
|
|
encoding: ENCODING_BITSTREAM,
|
|
|
|
trackMap: mockTMAP,
|
|
|
|
rawTracks: [new Uint8Array([
|
|
|
|
1, 1, 0, 1, 0, 1, 0, 1,
|
|
|
|
1, 0, 1, 0, 1, 0, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
])],
|
|
|
|
tracks: [new Uint8Array([0xD5, 0xAA, 0x96])],
|
2022-06-20 02:52:06 +00:00
|
|
|
info: {
|
2021-07-10 00:54:27 +00:00
|
|
|
bitTiming: 0,
|
|
|
|
bootSector: 0,
|
|
|
|
cleaned: 0,
|
|
|
|
compatibleHardware: 0,
|
|
|
|
creator: 'Apple2JS ',
|
|
|
|
diskType: 1,
|
|
|
|
largestTrack: 0,
|
|
|
|
requiredRAM: 0,
|
|
|
|
sides: 1,
|
|
|
|
synchronized: 1,
|
|
|
|
version: 2,
|
|
|
|
writeProtected: 0
|
|
|
|
}
|
2022-06-20 02:52:06 +00:00
|
|
|
});
|
2021-07-10 00:54:27 +00:00
|
|
|
});
|
|
|
|
});
|