Used visits count component in short URL visits view

This commit is contained in:
Alejandro Celaya
2020-01-11 20:10:12 +01:00
parent 3f2162fe62
commit 595858ac4b
3 changed files with 12 additions and 16 deletions

View File

@@ -11,24 +11,20 @@ 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} shortUrlVisits={shortUrlVisits} shortLink="foo" />
);
wrapper = shallow(<VisitsHeader shortUrlDetail={shortUrlDetail} />);
});
afterEach(() => wrapper.unmount());
it('shows the amount of visits', () => {
const visitsBadge = wrapper.find('.badge');
expect(visitsBadge.text()).toEqual(`Visits: ${shortUrlVisits.visits.length}`);
expect(visitsBadge.html()).toContain(`Visits: <span>${shortUrlDetail.shortUrl.visitsCount}</span>`);
});
it('shows when the URL was created', () => {