diff --git a/test/index.js b/test/index.js index f1e7bf8..341ae83 100644 --- a/test/index.js +++ b/test/index.js @@ -206,3 +206,19 @@ test('explicitly use exposed variadic strategy', () => { // Teardown spy.mockRestore() }) + +test('memoize functions with circular ref', () => { + const state = {a: 'hello'} + state.b = state + + function reducer (state) { + return {...state, a: state.a + ' world'} + } + + const memoizedState = memoize(reducer) + + // Assertions + + expect(memoizedState(state)).toBe({...state, a: state.a + ' world'}) +}) +