useLegacyStore.spec.tsx 622 B

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