startTrialButton.spec.tsx 975 B

123456789101112131415161718192021222324252627282930
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
  3. import {render, screen, waitFor} from 'sentry-test/reactTestingLibrary';
  4. import StartTrialButton from 'getsentry/components/startTrialButton';
  5. describe('StartTrialButton', function () {
  6. let org: any, endpoint: any;
  7. beforeEach(() => {
  8. MockApiClient.clearMockResponses();
  9. org = OrganizationFixture();
  10. endpoint = MockApiClient.addMockResponse({
  11. url: `/subscriptions/${org.slug}/`,
  12. method: 'GET',
  13. body: SubscriptionFixture({organization: org}),
  14. });
  15. });
  16. it('renders', async function () {
  17. render(
  18. <StartTrialButton aria-label="start trial" organization={org} source="test-abc" />
  19. );
  20. await waitFor(() => expect(endpoint).toHaveBeenCalled());
  21. expect(screen.getByRole('button')).toBeInTheDocument();
  22. expect(screen.getByText('Start trial')).toBeInTheDocument();
  23. });
  24. });