Skip to content

Commit 2e26b85

Browse files
committed
Add tests for missing duration
1 parent dd8600f commit 2e26b85

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

extensions/ql-vscode/src/view/variant-analysis/__tests__/VariantAnalysisStats.spec.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe(VariantAnalysisStats.name, () => {
3232
render({ resultCount: 123456 });
3333

3434
expect(screen.getByText('123,456')).toBeInTheDocument();
35+
expect(screen.queryAllByText('-').length).toBe(1);
3536
});
3637

3738
it('renders the number of repositories as a formatted number', () => {
@@ -102,10 +103,18 @@ describe(VariantAnalysisStats.name, () => {
102103
expect(screen.queryByText('Succeeded warnings')).not.toBeInTheDocument();
103104
});
104105

106+
it('does not render the duration when the completedAt is not set', () => {
107+
render({ createdAt: new Date('2021-05-01T00:00:00Z') });
108+
109+
expect(screen.queryAllByText('-').length).toBe(2);
110+
expect(screen.queryByText('Less than a second')).not.toBeInTheDocument();
111+
});
112+
105113
it('renders the duration when it is less than a second', () => {
106114
render({ createdAt: new Date('2021-05-01T00:00:00Z'), completedAt: new Date('2021-05-01T00:00:00Z') });
107115

108116
expect(screen.getByText('Less than a second')).toBeInTheDocument();
117+
expect(screen.queryAllByText('-').length).toBe(1);
109118
});
110119

111120
it('renders the duration when it is less than a minute', () => {

0 commit comments

Comments
 (0)