Skip to content

Commit

Permalink
fix(open-amdocs#77): Removed useUnmounted test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaeaehrlich committed Feb 7, 2022
1 parent 6eb3667 commit 79d62cc
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/hooks/useMounted/useMounted.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {act} from 'react-dom/test-utils';
import {mount} from 'enzyme';
import {useMounted, useUnmounted} from './useMounted';
import {useMounted} from './useMounted';

describe('useMounted()', () => {
it('Should return the previous value', () => {
Expand All @@ -20,21 +20,3 @@ describe('useMounted()', () => {
expect(wrapper.find('.unmounted').length).toEqual(0);
});
});

describe('useUnmounted()', () => {
it('Should return the previous value', () => {
const Elem = () => {
const unmounted = useUnmounted();
return (
<div className={`${unmounted ? 'un' : ''}mounted`}/>
);
};
let wrapper = null;
act(() => {wrapper = mount(<Elem/>)});
expect(wrapper.find('.unmounted').length).toEqual(0);
expect(wrapper.find('.mounted').length).toEqual(1);
wrapper.setProps({foo: 'bar'}); // Force an update...
expect(wrapper.find('.mounted').length).toEqual(1);
expect(wrapper.find('.unmounted').length).toEqual(0);
});
});

0 comments on commit 79d62cc

Please sign in to comment.