@@ -239,20 +239,15 @@ describe('ContestTableProviderBase and implementations', () => {
239239 describe ( 'Typical90 provider' , ( ) => {
240240 test ( 'expects to filter tasks to include only typical90 contest' , ( ) => {
241241 const provider = new Typical90Provider ( ContestType . TYPICAL90 ) ;
242- const mockTypical90Tasks = [
243- { contest_id : 'typical90' , task_id : 'typical90_a' , task_table_index : '001' } ,
244- { contest_id : 'typical90' , task_id : 'typical90_b' , task_table_index : '002' } ,
245- { contest_id : 'typical90' , task_id : 'typical90_j' , task_table_index : '010' } ,
246- { contest_id : 'typical90' , task_id : 'typical90_ck' , task_table_index : '089' } ,
247- { contest_id : 'typical90' , task_id : 'typical90_cl' , task_table_index : '090' } ,
242+ const mixedTaskResults = [
243+ ...mockTaskResults ,
248244 { contest_id : 'abc123' , task_id : 'abc123_a' , task_table_index : 'A' } ,
249245 { contest_id : 'dp' , task_id : 'dp_a' , task_table_index : 'A' } ,
250246 ] ;
251-
252- const filtered = provider . filter ( mockTypical90Tasks as any ) ;
247+ const filtered = provider . filter ( mixedTaskResults as TaskResults ) ;
253248
254249 expect ( filtered ?. every ( ( task ) => task . contest_id === 'typical90' ) ) . toBe ( true ) ;
255- expect ( filtered ?. length ) . toBe ( 5 ) ;
250+ expect ( filtered ?. length ) . toBe ( filtered . length ) ;
256251 expect ( filtered ) . not . toContainEqual ( expect . objectContaining ( { contest_id : 'abc123' } ) ) ;
257252 expect ( filtered ) . not . toContainEqual ( expect . objectContaining ( { contest_id : 'dp' } ) ) ;
258253 } ) ;
@@ -285,16 +280,8 @@ describe('ContestTableProviderBase and implementations', () => {
285280
286281 test ( 'expects to generate correct table structure' , ( ) => {
287282 const provider = new Typical90Provider ( ContestType . TYPICAL90 ) ;
288- const mockTypical90Tasks = [
289- { contest_id : 'typical90' , task_id : 'typical90_a' , task_table_index : '001' } ,
290- { contest_id : 'typical90' , task_id : 'typical90_b' , task_table_index : '002' } ,
291- { contest_id : 'typical90' , task_id : 'typical90_c' , task_table_index : '003' } ,
292- { contest_id : 'typical90' , task_id : 'typical90_j' , task_table_index : '010' } ,
293- { contest_id : 'typical90' , task_id : 'typical90_ck' , task_table_index : '089' } ,
294- { contest_id : 'typical90' , task_id : 'typical90_cl' , task_table_index : '090' } ,
295- ] ;
296-
297- const table = provider . generateTable ( mockTypical90Tasks as any ) ;
283+ const filtered = provider . filter ( mockTaskResults as TaskResults ) ;
284+ const table = provider . generateTable ( filtered ) ;
298285
299286 expect ( table ) . toHaveProperty ( 'typical90' ) ;
300287 expect ( table . typical90 ) . toHaveProperty ( '001' ) ;
@@ -325,41 +312,28 @@ describe('ContestTableProviderBase and implementations', () => {
325312
326313 test ( 'expects to get contest round IDs correctly' , ( ) => {
327314 const provider = new Typical90Provider ( ContestType . TYPICAL90 ) ;
328- const mockTypical90Tasks = [
329- { contest_id : 'typical90' , task_id : 'typical90_a' , task_table_index : '001' } ,
330- { contest_id : 'typical90' , task_id : 'typical90_b' , task_table_index : '002' } ,
331- { contest_id : 'typical90' , task_id : 'typical90_c' , task_table_index : '003' } ,
332- { contest_id : 'typical90' , task_id : 'typical90_j' , task_table_index : '010' } ,
333- { contest_id : 'typical90' , task_id : 'typical90_ck' , task_table_index : '089' } ,
334- { contest_id : 'typical90' , task_id : 'typical90_cl' , task_table_index : '090' } ,
335- ] ;
336-
337- const roundIds = provider . getContestRoundIds ( mockTypical90Tasks as any ) ;
315+ const filtered = provider . filter ( mockTaskResults as TaskResults ) ;
316+ const roundIds = provider . getContestRoundIds ( filtered as TaskResults ) ;
338317
339318 expect ( roundIds ) . toEqual ( [ 'typical90' ] ) ;
340319 } ) ;
341320
342321 test ( 'expects to get header IDs for tasks correctly' , ( ) => {
343322 const provider = new Typical90Provider ( ContestType . TYPICAL90 ) ;
344- const mockTypical90Tasks = [
345- { contest_id : 'typical90' , task_id : 'typical90_a' , task_table_index : '001' } ,
346- { contest_id : 'typical90' , task_id : 'typical90_b' , task_table_index : '002' } ,
347- { contest_id : 'typical90' , task_id : 'typical90_c' , task_table_index : '003' } ,
323+ const taskResults = [
324+ ...mockTaskResults ,
348325 { contest_id : 'typical90' , task_id : 'typical90_d' , task_table_index : '004' } ,
349326 { contest_id : 'typical90' , task_id : 'typical90_e' , task_table_index : '005' } ,
350- { contest_id : 'typical90' , task_id : 'typical90_j' , task_table_index : '010' } ,
351- { contest_id : 'typical90' , task_id : 'typical90_ck' , task_table_index : '089' } ,
352- { contest_id : 'typical90' , task_id : 'typical90_cl' , task_table_index : '090' } ,
353327 ] ;
354-
355- const headerIds = provider . getHeaderIdsForTask ( mockTypical90Tasks as any ) ;
328+ const filtered = provider . filter ( taskResults as TaskResults ) ;
329+ const headerIds = provider . getHeaderIdsForTask ( filtered as TaskResults ) ;
356330
357331 expect ( headerIds ) . toEqual ( [ '001' , '002' , '003' , '004' , '005' , '010' , '089' , '090' ] ) ;
358332 } ) ;
359333
360334 test ( 'expects to handle empty task results' , ( ) => {
361335 const provider = new Typical90Provider ( ContestType . TYPICAL90 ) ;
362- const filtered = provider . filter ( [ ] ) ;
336+ const filtered = provider . filter ( [ ] as TaskResults ) ;
363337
364338 expect ( filtered ) . toEqual ( [ ] ) ;
365339 } ) ;
@@ -749,8 +723,8 @@ describe('prepareContestProviderPresets', () => {
749723 expect ( typeof presets . ABCLatest20Rounds ) . toBe ( 'function' ) ;
750724 expect ( typeof presets . ABC319Onwards ) . toBe ( 'function' ) ;
751725 expect ( typeof presets . ABC212ToABC318 ) . toBe ( 'function' ) ;
752- expect ( typeof presets . dps ) . toBe ( 'function' ) ;
753726 expect ( typeof presets . Typical90 ) . toBe ( 'function' ) ;
727+ expect ( typeof presets . dps ) . toBe ( 'function' ) ;
754728 } ) ;
755729
756730 test ( 'expects each preset to create independent instances' , ( ) => {
0 commit comments