test when no Splunk On Call annotations are provided

Signed-off-by: Mike Ball <mikedball@gmail.com>
This commit is contained in:
Mike Ball
2022-02-03 20:19:36 -05:00
parent 4bda7d3045
commit 07ffc7ca9d
@@ -84,6 +84,15 @@ const mockEntityWithRoutingKeyAnnotation = {
},
} as Entity;
const mockEntityNoAnnotation = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
metadata: {
name: 'splunkoncall-test',
annotations: {},
},
} as Entity;
const mockEntityNoIncidents = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
@@ -164,6 +173,20 @@ describe('SplunkOnCallCard', () => {
).toBeInTheDocument();
});
it('handles warning for missing required annotations', async () => {
const { getAllByText, queryByTestId } = render(
wrapInTestApp(
<ApiProvider apis={apis}>
<EntityProvider entity={mockEntityNoAnnotation}>
<EntitySplunkOnCallCard />
</EntityProvider>
</ApiProvider>,
),
);
await waitFor(() => !queryByTestId('progress'));
expect(getAllByText('Missing Annotation').length).toEqual(2);
});
it('handles warning for incorrect team annotation', async () => {
mockSplunkOnCallApi.getUsers = jest
.fn()