Files
ep-133-project-export/tests/midi-fs-sysex.test.ts

19 lines
690 B
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { parseSysExGetFileDataResponse } from '../src/lib/midi/fsSysex';
test('increments the complete uint16 file page across byte boundaries', () => {
const response = parseSysExGetFileDataResponse(new Uint8Array([0x01, 0xff, 0xaa, 0xbb]));
assert.equal(response.page, 0x01ff);
assert.equal(response.nextPage, 0x0200);
assert.deepEqual(response.data, new Uint8Array([0xaa, 0xbb]));
});
test('wraps the file page only after uint16 max', () => {
const response = parseSysExGetFileDataResponse(new Uint8Array([0xff, 0xff]));
assert.equal(response.page, 0xffff);
assert.equal(response.nextPage, 0);
});