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

Refactor frontend tests

parent db49f207
...@@ -120,20 +120,20 @@ describe('detailedMetric', () => { ...@@ -120,20 +120,20 @@ describe('detailedMetric', () => {
}); });
}); });
describe('when the details have summaryOptions option', () => {
const gitalyDetails = {
duration: '123ms',
calls: 456,
details: requestDetails,
warnings: ['gitaly calls: 456 over 30'],
};
describe('when the details have summaryOptions > hideTotal option', () => { describe('when the details have summaryOptions > hideTotal option', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
currentRequest: { currentRequest: {
details: { details: {
gitaly: { gitaly: { ...gitalyDetails, summaryOptions: { hideTotal: true } },
duration: '123ms',
calls: 456,
details: requestDetails,
warnings: ['gitaly calls: 456 over 30'],
summaryOptions: {
hideTotal: true,
},
},
}, },
}, },
}); });
...@@ -149,15 +149,7 @@ describe('detailedMetric', () => { ...@@ -149,15 +149,7 @@ describe('detailedMetric', () => {
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,
},
},
}, },
}, },
}); });
...@@ -174,10 +166,7 @@ describe('detailedMetric', () => { ...@@ -174,10 +166,7 @@ describe('detailedMetric', () => {
currentRequest: { currentRequest: {
details: { details: {
gitaly: { gitaly: {
duration: '123ms', ...gitalyDetails,
calls: 456,
details: requestDetails,
warnings: ['gitaly calls: 456 over 30'],
summary: { summary: {
'In controllers': 100, 'In controllers': 100,
'In middlewares': 20, 'In middlewares': 20,
...@@ -196,6 +185,7 @@ describe('detailedMetric', () => { ...@@ -196,6 +185,7 @@ describe('detailedMetric', () => {
expect(findAllSummaryItems()).toEqual(['In controllers 100', 'In middlewares 20']); expect(findAllSummaryItems()).toEqual(['In controllers 100', 'In middlewares 20']);
}); });
}); });
});
describe("when the details don't have a start field", () => { describe("when the details don't have a start field", () => {
beforeEach(() => { beforeEach(() => {
......
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