useLegacyStore.spec.tsx 582 B

1234567891011121314151617181920
  1. import {reactHooks} from 'sentry-test/reactTestingLibrary';
  2. import TeamStore from 'sentry/stores/teamStore';
  3. import {useLegacyStore} from 'sentry/stores/useLegacyStore';
  4. describe('useLegacyStore', () => {
  5. const team = TestStubs.Team();
  6. beforeEach(() => void TeamStore.reset());
  7. it('should update on change to store', () => {
  8. const {result} = reactHooks.renderHook(() => useLegacyStore(TeamStore));
  9. expect(result.current.teams).toEqual([]);
  10. reactHooks.act(() => TeamStore.loadInitialData([team]));
  11. expect(result.current.teams).toEqual([team]);
  12. });
  13. });