useUserQuery.spec.tsx 551 B

123456789101112131415161718192021
  1. import {act, render} from 'sentry-test/reactTestingLibrary';
  2. import {useUserQuery} from 'sentry/views/explore/hooks/useUserQuery';
  3. describe('useUserQuery', function () {
  4. it('allows changing user query', function () {
  5. let userQuery, setUserQuery;
  6. function TestPage() {
  7. [userQuery, setUserQuery] = useUserQuery();
  8. return null;
  9. }
  10. render(<TestPage />, {disableRouterMocks: true});
  11. expect(userQuery).toEqual(''); // default
  12. act(() => setUserQuery('foo:bar'));
  13. expect(userQuery).toEqual('foo:bar');
  14. });
  15. });