contactBillingMembers.spec.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import {MemberFixture} from 'sentry-fixture/member';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import ContactBillingMembers from './contactBillingMembers';
  4. describe('ContactBillingMembers', () => {
  5. it('renders helpful members', async () => {
  6. const member = MemberFixture();
  7. MockApiClient.addMockResponse({
  8. url: `/organizations/org-slug/members/`,
  9. method: 'GET',
  10. body: [member],
  11. });
  12. render(<ContactBillingMembers />);
  13. expect(await screen.findByText(/Maybe a billing admin/)).toHaveTextContent(
  14. // Text is broken up by a link
  15. `Maybe a billing admin (${member.email}) could help?`
  16. );
  17. });
  18. it('does not render helpful members', async () => {
  19. MockApiClient.addMockResponse({
  20. url: `/organizations/org-slug/members/`,
  21. method: 'GET',
  22. body: [],
  23. });
  24. render(<ContactBillingMembers />);
  25. expect(
  26. await screen.findByText(
  27. `You don't have access to manage billing and subscription details.`
  28. )
  29. ).toBeInTheDocument();
  30. });
  31. });