Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Module not found even though it is imported

When I run this test:

describe('<Reissue />', () => {
    it('calls reissue service', () => {
        const handleClose = () => null;
        const disableButton = () => null;
        const showPrompt = true;
        const po = '123456';

        const wrapper = shallow(<Reissue handleClose={handleClose} disableButton={disableButton} showPrompt={showPrompt} pol={pol}/>);
        expect(wrapper.find('.reissue').length).toBe(1);
    });    
});

I get this error:

Cannot find module 'src/services/ReissueService/ReissueService' from 'Reissue.tsx'

      14 | interface State {
      15 |     confirmButton: boolean;
    > 16 |     confirmed: boolean;
      17 | }
      18 |
      19 | export class Reissue extends React.Component<Props, State> {

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:169:17)
      at Object.<anonymous> (src/components/reissue/ReissueCert.tsx:16:27)

Reissue.tsx does import ReissueService. Do I need to mock this and if so how do I do that?

In Reissue my import is:

import { ReissueService } from 'src/services/ReissueService/ReissueService';

and I'm exporting:

export class Reissue extends React.Component<Props, State> {...

In ReissueService I export:

export interface ReissueURL {...

export class ReissueService {...
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I changed import { ReissueService } from 'src/services/ReissueService/ReissueService'; to import { ReissueService } from '../../services/ReissueService/ReissueService';

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!