Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

refactor: adds no uplink spec #213

Merged
merged 2 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/components/UpLinks/UpLinks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ describe('<UpLinks /> component', () => {
expect(wrapper.html()).toBeNull();
});

test('should render the component when there is no uplink', () => {
const packageMeta = {
latest: {
name: 'verdaccio',
version: '4.0.0',
dist: { fileCount: 0, unpackedSize: 0 },
},
_uplinks: {},
};

const wrapper = mount(
<DetailContext.Provider value={{ packageMeta }}>
<UpLinks />
</DetailContext.Provider>
);
expect(wrapper.html()).toMatchSnapshot();
});

test('should render the component with uplinks', () => {
const packageMeta = {
latest: {
Expand Down
2 changes: 2 additions & 0 deletions src/components/UpLinks/__snapshots__/UpLinks.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<UpLinks /> component should render the component when there is no uplink 1`] = `"<h6 class=\\"MuiTypography-root MuiTypography-subtitle1 MuiTypography-gutterBottom\\">verdaccio has no uplinks.</h6>"`;

exports[`<UpLinks /> component should render the component with uplinks 1`] = `"<h6 class=\\"MuiTypography-root css-1vg6q84 e14i1sy10 MuiTypography-subtitle1\\">Uplinks</h6><ul class=\\"MuiList-root MuiList-padding\\"><li class=\\"MuiListItem-root MuiListItem-gutters\\"><div class=\\"MuiListItemText-root css-5tz9yo e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">npmjs</span></div><div class=\\"css-1l1cv61 e14i1sy11\\"></div><div class=\\"MuiListItemText-root css-5tz9yo e14i1sy12\\"><span class=\\"MuiTypography-root MuiListItemText-primary MuiTypography-body1\\">over 1 year ago</span></div></li></ul>"`;