-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement transformations #92
base: main
Are you sure you want to change the base?
Conversation
⏭️ No files to mutate for |
⏭️ No files to mutate for |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 100% | 0/0 |
🟢 | Branches | 100% | 0/0 |
🟢 | Functions | 100% | 0/0 |
🟢 | Lines | 100% | 0/0 |
Test suite run success
1 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 1a4cdbf
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 96.74% | 800/827 |
🟢 | Branches | 98.17% | 214/218 |
🟢 | Functions | 88.07% | 192/218 |
🟢 | Lines | 96.62% | 772/799 |
Test suite run success
404 tests passing in 24 suites.
Report generated by 🧪jest coverage report action from 1a4cdbf
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 89% (+2.89% 🔼) |
89/100 |
🟢 | Branches | 82.14% (+19.64% 🔼) |
46/56 |
🟢 | Functions | 100% | 12/12 |
🟢 | Lines | 89% (+2.89% 🔼) |
89/100 |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟢 | Operation.ts | 91.3% (-8.7% 🔻) |
89.74% (-10.26% 🔻) |
100% | 91.3% (-8.7% 🔻) |
Test suite run success
22 tests passing in 2 suites.
Report generated by 🧪jest coverage report action from 1a4cdbf
prevValue: type === OperationType.Delete ? value : '', | ||
newValue: type === OperationType.Insert ? value : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls remove this for Add/Remove opeeration, leave just data
/** | ||
* Do not transform operations if they are on different blocks or documents | ||
*/ | ||
if (this.index.documentId !== againstOp.index.documentId || this.index.blockIndex !== againstOp.index.blockIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to consider block index for text operations, if block before was added or deleted, we need to update the index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be done in a separate PR
const [ localStartIndex ] = againstOp.index.textRange!; | ||
|
||
switch (true) { | ||
case this.type === OperationType.Insert && againstOp.type === OperationType.Insert: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of the current operation doesn't matter here, index will be changed the same way for both insert and delte
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only three cases here:
- If received operation is delete operatio before (index-wise) the current, we need to update the current one index shifting it left
- If received operation is insert operation before (index-wise) the current, we need to shift index right
- If operation of any type happened after (index-wise) the current, no need to do anything
expect(transformedOp.index.textRange).toEqual([6, 6]); | ||
}); | ||
|
||
test('Should not change a received operation if it is at the same position as a local one', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If position is the same, the index should change by the length of text in received operation
Transformer
class to theOperation
class