[TNL-7268] Address the review comments

This commit is contained in:
Agrendalath
2020-06-29 09:35:59 +02:00
committed by David Joy
parent 6f7ec81197
commit e6443ae3bd
3 changed files with 181 additions and 164 deletions

View File

@@ -61,5 +61,8 @@ describe('Sequence Navigation Dropdown', () => {
screen.getAllByText(/^\d+$/).forEach(element => fireEvent.click(element));
expect(onNavigate).toHaveBeenCalledTimes(testUnits.length);
testUnits.forEach(unit => {
expect(onNavigate).toHaveBeenNthCalledWith(Number(unit), unit);
});
});
});

View File

@@ -1,5 +1,7 @@
import React from 'react';
import { render, screen } from '../../../../setupTest';
import {
initialState, render, screen, testUnits,
} from '../../../../setupTest';
import SequenceNavigationTabs from './SequenceNavigationTabs';
import useIndexOfLastVisibleChild from '../../../../tabs/useIndexOfLastVisibleChild';
@@ -7,22 +9,6 @@ import useIndexOfLastVisibleChild from '../../../../tabs/useIndexOfLastVisibleCh
jest.mock('../../../../tabs/useIndexOfLastVisibleChild');
describe('Sequence Navigation Tabs', () => {
const testUnits = [...Array(10).keys()].map(i => String(i + 1));
const initialState = {
models: {
units: testUnits.reduce(
(acc, unitId) => Object.assign(acc, {
[unitId]: {
contentType: 'other',
title: unitId,
},
}),
{},
),
},
};
const mockData = {
unitId: '1',
onNavigate: () => {