mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import ProjectExpectCtReports from 'sentry/views/settings/projectSecurityHeaders/expectCt';
|
|
|
|
describe('ProjectExpectCtReports', function () {
|
|
const {organization, project} = initializeOrg();
|
|
const keysUrl = `/projects/${organization.slug}/${project.slug}/keys/`;
|
|
|
|
beforeEach(function () {
|
|
MockApiClient.clearMockResponses();
|
|
MockApiClient.addMockResponse({
|
|
url: keysUrl,
|
|
method: 'GET',
|
|
body: [],
|
|
});
|
|
});
|
|
|
|
it('renders', async function () {
|
|
render(<ProjectExpectCtReports />, {
|
|
organization,
|
|
});
|
|
|
|
// Renders the loading indication initially
|
|
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
|
|
|
|
// Heading
|
|
expect(
|
|
await screen.findByText('Certificate Transparency', {selector: 'h4'})
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders loading error', async function () {
|
|
MockApiClient.addMockResponse({
|
|
url: keysUrl,
|
|
method: 'GET',
|
|
statusCode: 400,
|
|
body: {},
|
|
});
|
|
render(<ProjectExpectCtReports />, {
|
|
organization,
|
|
});
|
|
|
|
expect(
|
|
await screen.findByText('There was an error loading data.')
|
|
).toBeInTheDocument();
|
|
});
|
|
});
|