diff --git a/test/visits/VisitsTable.test.tsx b/test/visits/VisitsTable.test.tsx index 6972cf35..7abc95a0 100644 --- a/test/visits/VisitsTable.test.tsx +++ b/test/visits/VisitsTable.test.tsx @@ -28,10 +28,20 @@ describe('', () => { const createWrapper = (visits: NormalizedVisit[], selectedVisits: NormalizedVisit[] = []) => wrapperFactory( { visits, selectedVisits }, ); - const createOrphanVisitsWrapper = (isOrphanVisits: boolean) => wrapperFactory({ isOrphanVisits }); + const createOrphanVisitsWrapper = (isOrphanVisits: boolean, version: SemVer) => wrapperFactory({ + isOrphanVisits, + selectedServer: Mock.of({ printableVersion: version, version }), + }); const createServerVersionWrapper = (version: SemVer) => wrapperFactory({ selectedServer: Mock.of({ printableVersion: version, version }), }); + const createWrapperWithBots = () => wrapperFactory({ + selectedServer: Mock.of({ printableVersion: '2.7.0', version: '2.7.0' }), + visits: [ + Mock.of({ potentialBot: false }), + Mock.of({ potentialBot: true }), + ], + }); afterEach(jest.resetAllMocks); afterEach(() => wrapper?.unmount()); @@ -146,10 +156,12 @@ describe('', () => { }); it.each([ - [ true, 8 ], - [ false, 7 ], - ])('displays proper amount of columns for orphan and non-orphan visits', (isOrphanVisits, expectedCols) => { - const wrapper = createOrphanVisitsWrapper(isOrphanVisits); + [ true, '2.6.0' as SemVer, 8 ], + [ false, '2.6.0' as SemVer, 7 ], + [ true, '2.7.0' as SemVer, 9 ], + [ false, '2.7.0' as SemVer, 8 ], + ])('displays proper amount of columns for orphan and non-orphan visits', (isOrphanVisits, version, expectedCols) => { + const wrapper = createOrphanVisitsWrapper(isOrphanVisits, version); const rowsWithColspan = wrapper.find('[colSpan]'); const cols = wrapper.find('th'); @@ -157,4 +169,12 @@ describe('', () => { expect(rowsWithColspan).toHaveLength(2); rowsWithColspan.forEach((row) => expect(row.prop('colSpan')).toEqual(expectedCols)); }); + + it('displays bots icon when a visit is a potential bot', () => { + const wrapper = createWrapperWithBots(); + const rows = wrapper.find('tbody').find('tr'); + + expect(rows.at(0).find('td').at(1).text()).not.toContain('FontAwesomeIcon'); + expect(rows.at(1).find('td').at(1).text()).toContain('FontAwesomeIcon'); + }); });