Thunk Removal Proof-of-concept (#98)
This commit is contained in:
16
src/hooks/utils.test.js
Normal file
16
src/hooks/utils.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as utils from './utils';
|
||||
|
||||
jest.unmock('./utils');
|
||||
|
||||
describe('app-level hooks', () => {
|
||||
describe('useValuecallback', () => {
|
||||
it('returns react callback with event target value', () => {
|
||||
const cb = val => ({ cb: val });
|
||||
const prereqs = ['test', 'prereqs'];
|
||||
const value = 'test-value';
|
||||
const out = utils.useValueCallback(cb, prereqs);
|
||||
expect(out.useCallback.cb({ target: { value } })).toEqual({ cb: value });
|
||||
expect(out.useCallback.prereqs).toEqual(prereqs);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user