11/* eslint-disable @typescript-eslint/no-magic-numbers */
22import type { BlockNodeSerialized , DataKey , DocumentIndex } from '@editorjs/model' ;
33import { IndexBuilder } from '@editorjs/model' ;
4- import { describe } from " @jest/globals" ;
4+ import { describe } from ' @jest/globals' ;
55import { type InsertOrDeleteOperationData , type ModifyOperationData , Operation , OperationType } from './Operation.js' ;
66
77const createOperation = (
@@ -18,7 +18,7 @@ const createOperation = (
1818 if ( Array . isArray ( value ) ) {
1919 index . addBlockIndex ( startIndex ) ;
2020 } else {
21- index . addDataKey ( 'text' as DataKey ) . addTextRange ( [ startIndex , startIndex ] ) ;
21+ index . addDataKey ( 'text' as DataKey ) . addTextRange ( [ startIndex , startIndex ] ) ;
2222 }
2323
2424 const data : InsertOrDeleteOperationData | ModifyOperationData = {
@@ -33,7 +33,7 @@ const createOperation = (
3333 return new Operation (
3434 type ,
3535 index . build ( ) ,
36- data ,
36+ data
3737 ) ;
3838} ;
3939
@@ -102,15 +102,15 @@ describe('Operation', () => {
102102 const localOp = createOperation ( OperationType . Insert , 0 , 'abc' ) ;
103103 const transformedOp = receivedOp . transform ( localOp ) ;
104104
105- expect ( transformedOp . index . textRange ) . toEqual ( [ 6 , 6 ] ) ;
105+ expect ( transformedOp . index . textRange ) . toEqual ( [ 6 , 6 ] ) ;
106106 } ) ;
107107
108108 it ( 'should transform a received operation if it is at the same position as a local one' , ( ) => {
109109 const receivedOp = createOperation ( OperationType . Modify , 0 , 'abc' ) ;
110110 const localOp = createOperation ( OperationType . Insert , 0 , 'def' ) ;
111111 const transformedOp = receivedOp . transform ( localOp ) ;
112112
113- expect ( transformedOp . index . textRange ) . toEqual ( [ 3 , 3 ] ) ;
113+ expect ( transformedOp . index . textRange ) . toEqual ( [ 3 , 3 ] ) ;
114114 } ) ;
115115
116116 it ( 'should not change the text index if local op is a Block operation' , ( ) => {
@@ -121,7 +121,7 @@ describe('Operation', () => {
121121 } ] ) ;
122122 const transformedOp = receivedOp . transform ( localOp ) ;
123123
124- expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
124+ expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
125125 } ) ;
126126
127127 it ( 'should not change the operation if local op is a Block operation after a received one' , ( ) => {
@@ -184,15 +184,15 @@ describe('Operation', () => {
184184 const localOp = createOperation ( OperationType . Delete , 0 , 'abc' ) ;
185185 const transformedOp = receivedOp . transform ( localOp ) ;
186186
187- expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
187+ expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
188188 } ) ;
189189
190190 it ( 'should transform a received operation if it is at the same position as a local one' , ( ) => {
191191 const receivedOp = createOperation ( OperationType . Modify , 3 , 'abc' ) ;
192192 const localOp = createOperation ( OperationType . Delete , 3 , 'def' ) ;
193193 const transformedOp = receivedOp . transform ( localOp ) ;
194194
195- expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
195+ expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
196196 } ) ;
197197
198198 it ( 'should not change the text index if local op is a Block operation' , ( ) => {
@@ -203,7 +203,7 @@ describe('Operation', () => {
203203 } ] ) ;
204204 const transformedOp = receivedOp . transform ( localOp ) ;
205205
206- expect ( transformedOp . index . textRange ) . toEqual ( [ 1 , 1 ] ) ;
206+ expect ( transformedOp . index . textRange ) . toEqual ( [ 1 , 1 ] ) ;
207207 } ) ;
208208
209209 it ( 'should not change the text index if local op is a Block operation' , ( ) => {
@@ -214,7 +214,7 @@ describe('Operation', () => {
214214 } ] ) ;
215215 const transformedOp = receivedOp . transform ( localOp ) ;
216216
217- expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
217+ expect ( transformedOp . index . textRange ) . toEqual ( [ 0 , 0 ] ) ;
218218 } ) ;
219219
220220 it ( 'should not change the operation if local op is a Block operation after a received one' , ( ) => {
@@ -304,7 +304,8 @@ describe('Operation', () => {
304304 const op = createOperation ( OperationType . Modify , 0 , { bold : true } , { bold : false } ) ;
305305 const inverted = op . inverse ( ) ;
306306
307- expect ( inverted . data ) . toEqual ( { payload : { bold : false } , prevPayload : { bold : true } } ) ;
307+ expect ( inverted . data ) . toEqual ( { payload : { bold : false } ,
308+ prevPayload : { bold : true } } ) ;
308309 } ) ;
309310
310311 it ( 'should throw an error if unsupported operation type is provided' , ( ) => {
0 commit comments