Commit b5357b2b authored by Quang-Minh Nguyen's avatar Quang-Minh Nguyen

Refactor frontend tests

parent db49f207
...@@ -120,80 +120,70 @@ describe('detailedMetric', () => { ...@@ -120,80 +120,70 @@ describe('detailedMetric', () => {
}); });
}); });
describe('when the details have summaryOptions > hideTotal option', () => { describe('when the details have summaryOptions option', () => {
beforeEach(() => { const gitalyDetails = {
createComponent({ duration: '123ms',
currentRequest: { calls: 456,
details: { details: requestDetails,
gitaly: { warnings: ['gitaly calls: 456 over 30'],
duration: '123ms', };
calls: 456,
details: requestDetails, describe('when the details have summaryOptions > hideTotal option', () => {
warnings: ['gitaly calls: 456 over 30'], beforeEach(() => {
summaryOptions: { createComponent({
hideTotal: true, currentRequest: {
}, details: {
gitaly: { ...gitalyDetails, summaryOptions: { hideTotal: true } },
}, },
}, },
}, });
}); });
});
it('displays a summary section', () => { it('displays a summary section', () => {
expect(findAllSummaryItems()).toEqual(['Total duration 123ms']); expect(findAllSummaryItems()).toEqual(['Total duration 123ms']);
});
}); });
});
describe('when the details have summaryOptions > hideDuration option', () => { describe('when the details have summaryOptions > hideDuration option', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
currentRequest: { currentRequest: {
details: { details: {
gitaly: { gitaly: { ...gitalyDetails, summaryOptions: { hideDuration: true } },
duration: '123ms',
calls: 456,
details: requestDetails,
warnings: ['gitaly calls: 456 over 30'],
summaryOptions: {
hideDuration: true,
},
}, },
}, },
}, });
}); });
});
it('displays a summary section', () => { it('displays a summary section', () => {
expect(findAllSummaryItems()).toEqual(['Total 456']); expect(findAllSummaryItems()).toEqual(['Total 456']);
});
}); });
});
describe('when the details have both summary and summaryOptions field', () => { describe('when the details have both summary and summaryOptions field', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
currentRequest: { currentRequest: {
details: { details: {
gitaly: { gitaly: {
duration: '123ms', ...gitalyDetails,
calls: 456, summary: {
details: requestDetails, 'In controllers': 100,
warnings: ['gitaly calls: 456 over 30'], 'In middlewares': 20,
summary: { },
'In controllers': 100, summaryOptions: {
'In middlewares': 20, hideDuration: true,
}, hideTotal: true,
summaryOptions: { },
hideDuration: true,
hideTotal: true,
}, },
}, },
}, },
}, });
}); });
});
it('displays a summary section', () => { it('displays a summary section', () => {
expect(findAllSummaryItems()).toEqual(['In controllers 100', 'In middlewares 20']); expect(findAllSummaryItems()).toEqual(['In controllers 100', 'In middlewares 20']);
});
}); });
}); });
......
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