@@ -11,7 +11,7 @@ import {
1111 DataGroup
1212} from '../src/data/aggr_structures' ;
1313
14- // Тесты для AggregationColumnStore
14+ // Tests for AggregationColumnStore
1515describe ( 'AggregationColumnStore Interface' , ( ) => {
1616 let columnStore : AggregationColumnStore ;
1717
@@ -35,30 +35,30 @@ describe('AggregationColumnStore Interface', () => {
3535 } ;
3636 } ) ;
3737
38- it ( 'должен возвращать массив идентификаторов колонок в указанном диапазоне ' , ( ) => {
38+ it ( 'should return an array of column identifiers in specified range ' , ( ) => {
3939 const columns = columnStore . getColumnIds ( 1 , 3 ) ;
4040 expect ( columns ) . toBeArrayEqual ( [ 'col1' , 'col2' , 'col3' ] ) ;
4141 } ) ;
4242
43- it ( 'должен возвращать один идентификатор колонки, если указан только начальный индекс ' , ( ) => {
43+ it ( 'should return a single column identifier if only starting index is specified ' , ( ) => {
4444 const columns = columnStore . getColumnIds ( 5 ) ;
4545 expect ( columns ) . toBeArrayEqual ( [ 'col5' ] ) ;
4646 } ) ;
4747
48- it ( 'должен проверять валидность колонок ' , ( ) => {
48+ it ( 'should check the column validity ' , ( ) => {
4949 expect ( columnStore . validateColumns ( [ 'col1' , 'col2' ] ) ) . toBe ( true ) ;
5050 expect ( columnStore . validateColumns ( [ 'col1' , 'invalid' ] ) ) . toBe ( false ) ;
5151 } ) ;
5252
53- it ( 'должен проверять валидность агрегатной функции для колонки ' , ( ) => {
53+ it ( 'should check the aggregate function validity for column ' , ( ) => {
5454 expect ( columnStore . validateAggregate ( 'col1' , 'sum' ) ) . toBe ( true ) ;
5555 expect ( columnStore . validateAggregate ( 'col2' , 'avg' ) ) . toBe ( true ) ;
5656 expect ( columnStore . validateAggregate ( 'col3' , 'invalid' ) ) . toBe ( false ) ;
5757 expect ( columnStore . validateAggregate ( 'invalid' , 'sum' ) ) . toBe ( false ) ;
5858 } ) ;
5959} ) ;
6060
61- // Тесты для AggregatesContainer
61+ // Tests for AggregatesContainer
6262describe ( 'AggregatesContainer Interface' , ( ) => {
6363 let container : AggregatesContainer ;
6464
@@ -89,27 +89,27 @@ describe('AggregatesContainer Interface', () => {
8989 } ;
9090 } ) ;
9191
92- it ( 'должен сохранять данные агрегации для определенного уровня ' , ( ) => {
92+ it ( 'should save aggregate data for a specific level ' , ( ) => {
9393 const data = new Map < string , GroupTotals > ( ) ;
9494 data . set ( JSON . stringify ( { col1 : 'value1' } ) , { sum : 100 , count : 10 } ) ;
9595
9696 container . setAggregateData ( 1 , data ) ;
97-
98- // Проверим через getAggregateData
97+
98+ // Check this through getAggregateData
9999 return container . getAggregateData ( 1 , { col1 : 'value1' } )
100100 . then ( totals => {
101101 expect ( totals ) . toBeObject ( { sum : 100 , count : 10 } ) ;
102102 } ) ;
103103 } ) ;
104104
105- it ( 'должен возвращать пустой объект для несуществующего уровня ' , ( ) => {
105+ it ( 'should return an empty object for a non-existent level ' , ( ) => {
106106 return container . getAggregateData ( 999 , { col1 : 'value1' } )
107107 . then ( totals => {
108108 expect ( totals ) . toBeObject ( { } ) ;
109109 } ) ;
110110 } ) ;
111111
112- it ( 'должен обновлять данные агрегации ' , ( ) => {
112+ it ( 'should update aggregate data ' , ( ) => {
113113 container . updateAggregateData ( 1 , { col1 : 'value1' } , { sum : 100 } ) ;
114114 container . updateAggregateData ( 1 , { col1 : 'value1' } , { sum : 200 } ) ;
115115
@@ -119,7 +119,7 @@ describe('AggregatesContainer Interface', () => {
119119 } ) ;
120120 } ) ;
121121
122- it ( 'должен создавать новый уровень при обновлении данных несуществующего уровня ' , ( ) => {
122+ it ( 'should create a new level when updating data for a non-existent level ' , ( ) => {
123123 container . updateAggregateData ( 2 , { col2 : 'value2' } , { avg : 50 } ) ;
124124
125125 return container . getAggregateData ( 2 , { col2 : 'value2' } )
@@ -129,14 +129,14 @@ describe('AggregatesContainer Interface', () => {
129129 } ) ;
130130} ) ;
131131
132- // Тесты для AggregatesCalculator
132+ // Tests for AggregatesCalculator
133133describe ( 'AggregatesCalculator Interface' , ( ) => {
134134 let container : AggregatesContainer ;
135135 let calculator : AggregatesCalculator ;
136136 let needRecalculationValue : boolean ;
137137
138138 beforeEach ( ( ) => {
139- // Создаем мок для AggregatesContainer
139+ // Create mock for AggregatesContainer
140140 container = {
141141 setAggregateData : mock ( ) ,
142142 getAggregateData : mock ( ) . mockImplementation ( async ( ) => ( { } ) ) ,
@@ -145,7 +145,7 @@ describe('AggregatesCalculator Interface', () => {
145145
146146 needRecalculationValue = true ;
147147
148- // Создаем мок для AggregatesCalculator
148+ // Create a mock for AggregatesCalculator
149149 calculator = {
150150 getAggrContainer : ( ) => container ,
151151
@@ -160,7 +160,7 @@ describe('AggregatesCalculator Interface', () => {
160160 throw error ;
161161 }
162162
163- // Симулируем вычисление и получение результата
163+ // Simulate calculation and obtaining result
164164 const result = { sum : 100 , count : 10 } ;
165165 if ( options ?. resultObtained ) {
166166 options . resultObtained ( result , 1 ) ;
@@ -177,12 +177,12 @@ describe('AggregatesCalculator Interface', () => {
177177 } ;
178178 } ) ;
179179
180- it ( 'должен возвращать контейнер агрегатов ' , ( ) => {
180+ it ( 'should return an aggregate container ' , ( ) => {
181181 const result = calculator . getAggrContainer ( ) ;
182182 expect ( result ) . toBe ( container ) ;
183183 } ) ;
184184
185- it ( 'должен выполнять вычисление с вызовом callback-функций ' , async ( ) => {
185+ it ( 'should perform a calculation with callback functions ' , async ( ) => {
186186 const resultCallback = mock ( ) ;
187187 const errorCallback = mock ( ) ;
188188
@@ -196,7 +196,7 @@ describe('AggregatesCalculator Interface', () => {
196196 expect ( calculator . needRecalculation ( ) ) . toBe ( false ) ;
197197 } ) ;
198198
199- it ( 'должен вызывать errorOccurred при ошибке вычисления ' , async ( ) => {
199+ it ( 'should call the errorOccurred on calculation error ' , async ( ) => {
200200 const resultCallback = mock ( ) ;
201201 const errorCallback = mock ( ) ;
202202
@@ -207,7 +207,7 @@ describe('AggregatesCalculator Interface', () => {
207207 errorOccurred : errorCallback
208208 } ) ;
209209 } catch ( error ) {
210- // Ожидаем, что ошибка будет перехвачена
210+ // Expect the error to be caught
211211 }
212212
213213 expect ( resultCallback ) . not . toHaveBeenCalled ( ) ;
@@ -217,20 +217,20 @@ describe('AggregatesCalculator Interface', () => {
217217 expect ( error . level ) . toBe ( 0 ) ;
218218 } ) ;
219219
220- it ( 'должен возвращать needRecalculation=true после reset' , ( ) => {
220+ it ( 'should return needRecalculation=true after reset' , ( ) => {
221221 calculator . reset ( ) ;
222222 expect ( calculator . needRecalculation ( ) ) . toBe ( true ) ;
223223 } ) ;
224224
225- it ( 'должен возвращать needRecalculation=false после успешного вычисления ' , async ( ) => {
225+ it ( 'should return needRecalculation=false after successful calculation ' , async ( ) => {
226226 await calculator . calculate ( ) ;
227227 expect ( calculator . needRecalculation ( ) ) . toBe ( false ) ;
228228 } ) ;
229229} ) ;
230230
231- // Тесты для структур данных
231+ // Tests for data structures
232232describe ( 'Data Structures' , ( ) => {
233- it ( 'должен правильно определять DataGroup' , ( ) => {
233+ it ( 'should correctly define a DataGroup' , ( ) => {
234234 const group : DataGroup = {
235235 name : 'TestGroup' ,
236236 columns : [ 'col1' , 'col2' ]
@@ -240,7 +240,7 @@ describe('Data Structures', () => {
240240 expect ( group . columns ) . toBeArrayEqual ( [ 'col1' , 'col2' ] ) ;
241241 } ) ;
242242
243- it ( 'должен работать с GroupKey как с объектом ' , ( ) => {
243+ it ( 'should work with GroupKey as an object ' , ( ) => {
244244 const key : GroupKey = {
245245 col1 : 'value1' ,
246246 col2 : 100
@@ -249,8 +249,8 @@ describe('Data Structures', () => {
249249 expect ( key . col1 ) . toBe ( 'value1' ) ;
250250 expect ( key . col2 ) . toBe ( 100 ) ;
251251 } ) ;
252-
253- it ( 'должен работать с GroupTotals как с объектом ' , ( ) => {
252+
253+ it ( 'should work with GroupTotals as an object ' , ( ) => {
254254 const totals : GroupTotals = {
255255 sum : 500 ,
256256 avg : 100 ,
@@ -262,15 +262,15 @@ describe('Data Structures', () => {
262262 expect ( totals . count ) . toBe ( 5 ) ;
263263 } ) ;
264264
265- it ( 'должен создавать AggrCalculationError с уровнем ' , ( ) => {
265+ it ( 'should create an AggrCalculationError with a level ' , ( ) => {
266266 const error = new Error ( 'Test error' ) as AggrCalculationError ;
267267 error . level = 2 ;
268268
269269 expect ( error . message ) . toBe ( 'Test error' ) ;
270270 expect ( error . level ) . toBe ( 2 ) ;
271271 } ) ;
272272
273- it ( 'должен создавать AggrCalculationOptions с опциями ' , ( ) => {
273+ it ( 'should create an AggrCalculationOptions with options ' , ( ) => {
274274 const options : AggrCalculationOptions = {
275275 maxLevel : 3 ,
276276 resultObtained : mock ( ) ,
0 commit comments