Categories
Development

Jest test passes locally but fails in azure devops

I have a react application using react-scripts 3.2.0 This is my test : jest.mock(‘./../shared/utils/getRequestWithDispatchUsing’, () => ({ __esModule: true, default: () => () => () => () => ‘getRequestWithDispatchUsing is success’, })); describe(‘getContractsUsing’, () => { const dispatch = jest.fn(action => action); const fetch = jest.fn(); const clientNumber = ‘clientNumber’; beforeEach(() => { jest.clearAllMocks(); }); […]

Categories
Development

“Navbar refers to a value, but is being used as a type here” when trying to render a shallow copy of my component when testing

I am trying to write a test to my React component, using TypeScript, Jest as my test runner and Enzyme for testing my React components. Whenever I pass my component into the shallow Enzyme function, I get the ts error “‘Navbar’ refers to a value, but is being used as a type here.”, and underneath […]