Commit 7076e34a authored by Kushal Pandya's avatar Kushal Pandya

Add tests for node details methods

parent 96590287
...@@ -55,6 +55,54 @@ describe('NodeDetailsSectionVerification', () => { ...@@ -55,6 +55,54 @@ describe('NodeDetailsSectionVerification', () => {
}); });
}); });
describe('methods', () => {
describe('getPrimaryNodeDetailItems', () => {
const primaryItems = [
{
title: 'Repository checksum progress',
valueProp: 'repositoriesChecksummed',
},
{
title: 'Wiki checksum progress',
valueProp: 'wikisChecksummed',
},
{
title: 'Replication slots',
valueProp: 'replicationSlots',
},
];
it('returns array containing items to show under primary node', () => {
const actualPrimaryItems = vm.getPrimaryNodeDetailItems();
primaryItems.forEach((item, index) => {
expect(actualPrimaryItems[index].itemTitle).toBe(item.title);
expect(actualPrimaryItems[index].itemValue).toBe(mockNodeDetails[item.valueProp]);
});
});
});
describe('getSecondaryNodeDetailItems', () => {
const secondaryItems = [
{
title: 'Repository verification progress',
valueProp: 'verifiedRepositories',
},
{
title: 'Wiki verification progress',
valueProp: 'verifiedWikis',
},
];
it('returns array containing items to show under secondary node', () => {
const actualSecondaryItems = vm.getSecondaryNodeDetailItems();
secondaryItems.forEach((item, index) => {
expect(actualSecondaryItems[index].itemTitle).toBe(item.title);
expect(actualSecondaryItems[index].itemValue).toBe(mockNodeDetails[item.valueProp]);
});
});
});
});
describe('template', () => { describe('template', () => {
it('renders component container element', () => { it('renders component container element', () => {
expect(vm.$el.classList.contains('verification-section')).toBe(true); expect(vm.$el.classList.contains('verification-section')).toBe(true);
......
...@@ -182,14 +182,24 @@ export const mockNodeDetails = { ...@@ -182,14 +182,24 @@ export const mockNodeDetails = {
successCount: 0, successCount: 0,
failureCount: 0, failureCount: 0,
}, },
repositoriesChecksummed: {
totalCount: 12,
successCount: 12,
failureCount: 0,
},
wikisChecksummed: {
totalCount: 12,
successCount: 12,
failureCount: 0,
},
verifiedRepositories: { verifiedRepositories: {
totalCount: 0, totalCount: 12,
successCount: 0, successCount: 12,
failureCount: 0, failureCount: 0,
}, },
verifiedWikis: { verifiedWikis: {
totalCount: 0, totalCount: 12,
successCount: 0, successCount: 12,
failureCount: 0, failureCount: 0,
}, },
lastEvent: { lastEvent: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment