Skip to content

Commit

Permalink
Start streaming to parse entire replay files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesremuscat committed Jul 26, 2024
1 parent ab5be9b commit 5634b3a
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/hhtiming/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecodeError, decodeLine } from '../index.js';
import { DecodeError, decodeLine, HHTimingConverter } from '../index.js';
import fs from 'fs';

const VALID_B64_ENCODED_DATA = 'PFBBU1M+DQogIDxJRD5mMGZmMzk4Zi00OWNhLTQ3MzItODA2Ni0wZTY1YzZlMTBlZGQ8L0lEPg0KICA8RFQ+MDIuMDcuMjAyMyAwMjo1MDozOC4wOTY8L0RUPg0KICA8QkI+OTExPC9CQj4NCiAgPElUPjM5ODExPC9JVD4NCiAgPExQPjIzNjwvTFA+DQogIDxTVD5JMTwvU1Q+DQogIDxWRT4yNjIuNzczPC9WRT4NCiAgPERSPjQ8L0RSPg0KPC9QQVNTPg==';

Expand Down Expand Up @@ -39,4 +40,15 @@ describe('HH Timing', () => {
expect(decodeLine(`2023-07-02 09:38:22.306395|${invalidXML}`)).rejects.toThrow(DecodeError);
});
});

describe('HHTimingConverter', () => {
it('parses and converts a file stream', async () => {
const inputStream = fs.createReadStream(
'src/hhtiming/__tests__/test.hhreplay',
{ highWaterMark: 8192 } // Deliberately small to force handling multiple chunks
);
const subject = new HHTimingConverter();
await subject.convert(inputStream);
});
});
});
Loading

0 comments on commit 5634b3a

Please sign in to comment.