Skip to content

Commit cc03dc9

Browse files
committed
Add a test.
1 parent fde207b commit cc03dc9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • x-pack/plugins/observability/public/components/app/section/ux

x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,27 @@ describe('UXSection', () => {
7676
expect(queryAllByText('View in app')).toEqual([]);
7777
expect(getByText('elastic-co-frontend')).toBeInTheDocument();
7878
});
79+
it('shows empty state', () => {
80+
jest.spyOn(fetcherHook, 'useFetcher').mockReturnValue({
81+
data: undefined,
82+
status: fetcherHook.FETCH_STATUS.SUCCESS,
83+
refetch: jest.fn(),
84+
});
85+
const { getByText, queryAllByText, getAllByText } = render(
86+
<UXSection
87+
absoluteTime={{
88+
start: moment('2020-06-29T11:38:23.747Z').valueOf(),
89+
end: moment('2020-06-29T12:08:23.748Z').valueOf(),
90+
}}
91+
relativeTime={{ start: 'now-15m', end: 'now' }}
92+
bucketSize="60s"
93+
serviceName="elastic-co-frontend"
94+
/>
95+
);
96+
97+
expect(getByText('User Experience')).toBeInTheDocument();
98+
expect(getAllByText('No data is available.')).toHaveLength(3);
99+
expect(queryAllByText('View in app')).toEqual([]);
100+
expect(getByText('elastic-co-frontend')).toBeInTheDocument();
101+
});
79102
});

0 commit comments

Comments
 (0)