-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
Milestone
Description
As a part of #1051 we'll need to port the following https://github.com/FlowCrypt/flowcrypt-browser/blob/master/extension/js/common/core/msg-block-parser.ts but only method detectBlocks with its private counterpart detectBlockNext. I recommend to port it line-by-line so that we can easily reason about it - the original parser is well battle tested.
The Android codebase already has a class similar to TypeScript's MsgBlock here https://github.com/FlowCrypt/flowcrypt-browser/blob/master/extension/js/common/core/msg-block.ts - @DenBond7 can you please point us to where is the Android/Kotlin equivalent defined?
For the implementation I'd recommend to do it in this order:
- open the typescript codebase in vscode to better understand it
- from https://github.com/FlowCrypt/flowcrypt-browser/blob/master/test/source/tests/unit-node.ts copy first 3 tests that start with
[unit][MsgBlockParser.detectBlocks]into kotlin - copy the algorithm and translate into Kotlin line by line
- most test cases are unfortunately, in browser-extension, run as integration tests. I recommend to find a way to run all tests and export the results into a file, to work as data for unit tests in Kotlin. I'm not entirely sure what the right way to do this is, since the test runner is in NodeJS but the tested code itself runs in puppeteer. When unsure, ask @rrrooommmaaa for help
- once exported data for unit tests, write appropriate Kotlin unit tests and fix implementation if necessary
Reactions are currently unavailable