useLegacyStore.spec.tsx 625 B

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