Replaced test by it in tests

This commit is contained in:
Alejandro Celaya 2021-03-06 17:25:09 +01:00
parent 426d000a59
commit e380ddb40f
5 changed files with 14 additions and 14 deletions

View file

@ -45,7 +45,7 @@ describe('<Overview />', () => {
afterEach(() => wrapper?.unmount());
test('cards display loading messages when still loading', () => {
it('displays loading messages when still loading', () => {
const wrapper = createWrapper(true);
const cards = wrapper.find(CardText);
@ -53,7 +53,7 @@ describe('<Overview />', () => {
cards.forEach((card) => expect(card.html()).toContain('Loading...'));
});
test('amounts are displayed in cards after finishing loading', () => {
it('displays amounts in cards after finishing loading', () => {
const wrapper = createWrapper();
const cards = wrapper.find(CardText);
@ -64,21 +64,21 @@ describe('<Overview />', () => {
expect(cards.at(3).html()).toContain(prettify(3));
});
test('first card displays warning for old shlink versions', () => {
it('displays warning in first card for old shlink versions', () => {
const wrapper = createWrapper();
const firstCard = wrapper.find(CardText).first();
expect(firstCard.html()).toContain('Shlink 2.2 is needed');
});
test('nests complex components', () => {
it('nests complex components', () => {
const wrapper = createWrapper();
expect(wrapper.find(CreateShortUrl)).toHaveLength(1);
expect(wrapper.find(ShortUrlsTable)).toHaveLength(1);
});
test('links to other sections are displayed', () => {
it('displays links to other sections', () => {
const wrapper = createWrapper();
const links = wrapper.find(Link);

View file

@ -13,7 +13,7 @@ describe('<CopyToClipboardIcon />', () => {
});
afterEach(() => wrapper?.unmount());
test('expected components are wrapped', () => {
it('wraps expected components', () => {
const copyToClipboard = wrapper.find(CopyToClipboard);
const icon = wrapper.find(FontAwesomeIcon);

View file

@ -14,13 +14,13 @@ describe('<DateIntervalDropdownItems />', () => {
afterEach(jest.clearAllMocks);
afterEach(() => wrapper?.unmount());
test('expected amount of items is rendered', () => {
it('renders expected amount of items', () => {
const items = wrapper.find(DropdownItem);
expect(items).toHaveLength(DATE_INTERVALS.length);
});
test('expected item is active', () => {
it('sets expected item as active', () => {
const items = wrapper.find(DropdownItem);
const EXPECTED_ACTIVE_INDEX = 5;
@ -28,7 +28,7 @@ describe('<DateIntervalDropdownItems />', () => {
items.forEach((item, index) => expect(item.prop('active')).toEqual(index === EXPECTED_ACTIVE_INDEX));
});
test('selecting an element triggers onChange callback', () => {
it('triggers onChange callback when selecting an element', () => {
const items = wrapper.find(DropdownItem);
items.at(2).simulate('click');

View file

@ -14,7 +14,7 @@ describe('<DateIntervalSelector />', () => {
});
afterEach(() => wrapper?.unmount());
test('props are passed down to nested DateIntervalDropdownItems', () => {
it('passes props down to nested DateIntervalDropdownItems', () => {
const items = wrapper.find(DateIntervalDropdownItems);
const dropdown = wrapper.find(DropdownBtn);

View file

@ -18,7 +18,7 @@ describe('<DateRangeSelector />', () => {
afterEach(jest.clearAllMocks);
afterEach(() => wrapper?.unmount());
test('proper amount of items is rendered', () => {
it('renders proper amount of items', () => {
const wrapper = createWrapper();
const items = wrapper.find(DropdownItem);
const dateIntervalItems = wrapper.find(DateIntervalDropdownItems);
@ -31,7 +31,7 @@ describe('<DateRangeSelector />', () => {
expect(items.filter('[active]')).toHaveLength(1);
});
test.each([
it.each([
[ undefined, 1, 0 ],
[ 'today' as DateInterval, 0, 1 ],
[ 'yesterday' as DateInterval, 0, 1 ],
@ -41,7 +41,7 @@ describe('<DateRangeSelector />', () => {
[ 'last180days' as DateInterval, 0, 1 ],
[ 'last365Days' as DateInterval, 0, 1 ],
[{ startDate: moment() }, 0, 0 ],
])('proper element is active based on provided date range', (
])('sets proper element as active based on provided date range', (
initialDateRange,
expectedActiveItems,
expectedActiveIntervalItems,
@ -56,7 +56,7 @@ describe('<DateRangeSelector />', () => {
expect(dateIntervalItems).toHaveLength(expectedActiveIntervalItems);
});
test('selecting an element triggers onDatesChange callback', () => {
it('triggers onDatesChange callback when selecting an element', () => {
const wrapper = createWrapper();
const item = wrapper.find(DropdownItem).at(0);
const dateIntervalItems = wrapper.find(DateIntervalDropdownItems);