Recovered behavior to show amount of visits in selected date range on visits detail page

This commit is contained in:
Alejandro Celaya
2020-01-15 18:31:28 +01:00
parent c90cd46095
commit 301da4bb2a
7 changed files with 30 additions and 21 deletions

View File

@@ -11,20 +11,22 @@ describe('<VisitsHeader />', () => {
shortUrl: 'https://doma.in/abc123',
longUrl: 'https://foo.bar/bar/foo',
dateCreated: '2018-01-01T10:00:00+01:00',
visitsCount: 3,
},
loading: false,
};
const shortUrlVisits = {
visits: [{}, {}, {}],
};
beforeEach(() => {
wrapper = shallow(<VisitsHeader shortUrlDetail={shortUrlDetail} />);
wrapper = shallow(<VisitsHeader shortUrlDetail={shortUrlDetail} shortUrlVisits={shortUrlVisits} />);
});
afterEach(() => wrapper.unmount());
it('shows the amount of visits', () => {
const visitsBadge = wrapper.find('.badge');
expect(visitsBadge.html()).toContain(`Visits: <span>${shortUrlDetail.shortUrl.visitsCount}</span>`);
expect(visitsBadge.html()).toContain(`Visits: <span>${shortUrlVisits.visits.length}</span>`);
});
it('shows when the URL was created', () => {