Skip to content

Commit

Permalink
feat: make tests import hooks from the index
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Apr 21, 2021
1 parent 4dc4a7e commit 3210650
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/useUpdateEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useFirstMountState } from './useFirstMountState';
* React effect hook that ignores the first invocation (e.g. on mount)
*
* @param effect effector to run on updates
* @param deps dependencies list, as for `useEffect` hook
*/
export function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void {
const isFirstMount = useFirstMountState();
Expand Down
2 changes: 1 addition & 1 deletion tests/dom/useMountEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/dom';
import { useMountEffect } from '../../src/useMountEffect';
import { useMountEffect } from '../../src';

describe('useMountEffect', () => {
it('should call effector only on first render', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/dom/useUnmountEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/dom';
import { useUnmountEffect } from '../../src/useUnmountEffect';
import { useUnmountEffect } from '../../src';

describe('useUnmountEffect', () => {
it('should call effector only when component unmounted', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/dom/useUpdateEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/dom';
import { useUpdateEffect } from '../../src/useUpdateEffect';
import { useUpdateEffect } from '../../src';

describe('useUpdateEffect', () => {
it('should call effector only on updates (after first render)', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/ssr/useMountEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/server';
import { useMountEffect } from '../../src/useMountEffect';
import { useMountEffect } from '../../src';

describe('useMountEffect', () => {
it('should call effector only on first render', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/ssr/useUnmountEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/server';
import { useUnmountEffect } from '../../src/useUnmountEffect';
import { useUnmountEffect } from '../../src';

describe('useUnmountEffect', () => {
it('should call effector only when component unmounted', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/ssr/useUpdateEffect.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react-hooks/server';
import { useUpdateEffect } from '../../src/useUpdateEffect';
import { useUpdateEffect } from '../../src';

describe('useUpdateEffect', () => {
it('should not call effector on mount', () => {
Expand Down

0 comments on commit 3210650

Please sign in to comment.