Skip to content

Commit 23aedb8

Browse files
committed
Add tests to cover new functionality in #4
1 parent 6a6f7e4 commit 23aedb8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/index.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,18 @@ describe('Hello component', () => {
4141

4242
documentSpy.mockRestore();
4343
});
44+
45+
it('Should use lodash.debounce when debounce is more than 0', () => {
46+
const wrapper = shallow(<BottomScrollListener debounce={200} onBottom={() => {}} />);
47+
const functionName = wrapper.instance().handleOnScroll.name;
48+
49+
expect(functionName).toEqual('debounced');
50+
});
51+
52+
it('Should not use lodash.debounce when debounce is 0', () => {
53+
const wrapper = shallow(<BottomScrollListener debounce={0} onBottom={() => {}} />);
54+
const functionName = wrapper.instance().handleOnScroll.name;
55+
56+
expect(functionName).toEqual('bound handleOnScroll');
57+
});
4458
});

0 commit comments

Comments
 (0)