如何在玩笑测试中模拟lib?

时间:2018-09-11 23:31:55

标签: javascript mocking jestjs

requestAnimationFrame()

jest.mock('../redux/storeConfigure', () => () => ({ getState: () => ({ auth: { token: 'TEST_TOKEN' } }) })) import { prepareRequestHeaders } from './fetch' describe('prepareRequestHeaders', () => { it('returns header with Authorization if token is set', () => { expect(prepareRequestHeaders()['Authorization']).toBe('Bearer TEST_TOKEN') }) it('returns header without Authorization if token is not set', () => { ????? }) }) 中,我导入prepareRequestHeaders

如何与其他实现重新模拟../redux/storeConfigure

编辑:

../redux/storeConfigure

0 个答案:

没有答案