Merge pull request #22645 from backstage/fix/response-error-status-code

Fix ResponseError HTTP status
This commit is contained in:
Vincenzo Scamporlino
2024-02-23 23:51:21 +01:00
committed by GitHub
11 changed files with 99 additions and 18 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ describe('api', () => {
it('should throw an error if the Vault API responds with a non-successful HTTP status code', async () => {
await expect(api.listSecrets('test/error')).rejects.toThrow(
'Request failed with 400 Error',
'Request failed with 400 Bad Request',
);
});
});
@@ -18,7 +18,7 @@ import React from 'react';
import { setupServer } from 'msw/node';
import { setupRequestMockHandlers } from '@backstage/test-utils';
import { ComponentEntity } from '@backstage/catalog-model';
import { render } from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
import { EntityVaultCard } from './EntityVaultCard';
import { EntityProvider } from '@backstage/plugin-catalog-react';
@@ -45,8 +45,11 @@ describe('EntityVaultCard', () => {
<EntityVaultCard />
</EntityProvider>,
);
expect(
rendered.getByText(/Add the annotation to your Component YAML/),
).toBeInTheDocument();
await waitFor(() =>
expect(
rendered.getByText(/Add the annotation to your Component YAML/),
).toBeInTheDocument(),
);
});
});
@@ -161,7 +161,7 @@ describe('EntityVaultTable', () => {
expect(
rendered.getByText(
/Unexpected error while fetching secrets from path \'test\/error\'\: Request failed with 400 Error/,
/Unexpected error while fetching secrets from path \'test\/error\'\: Request failed with 400 Bad Request/,
),
).toBeInTheDocument();
});