projects.spec.jsx 884 B

12345678910111213141516171819202122232425262728293031
  1. import {Client} from 'app/api';
  2. import {_debouncedLoadStats} from 'app/actionCreators/projects';
  3. describe('Projects ActionCreators', function() {
  4. const api = new Client();
  5. const organization = TestStubs.Organization();
  6. let mock;
  7. it('loadStatsForProject', function() {
  8. jest.useFakeTimers();
  9. mock = MockApiClient.addMockResponse({
  10. url: '/organizations/org-slug/projects/',
  11. });
  12. expect(mock).not.toHaveBeenCalled();
  13. _debouncedLoadStats(api, new Set([...Array(50)].map((_, i) => i)), {
  14. orgId: organization.slug,
  15. });
  16. expect(mock).toHaveBeenCalledTimes(5);
  17. expect(mock).toHaveBeenLastCalledWith(
  18. '/organizations/org-slug/projects/',
  19. expect.objectContaining({
  20. query: {
  21. statsPeriod: '24h',
  22. query: 'id:40 id:41 id:42 id:43 id:44 id:45 id:46 id:47 id:48 id:49',
  23. },
  24. })
  25. );
  26. });
  27. });