Getting error in my test file using jest/typescript

test file

I’m getting this message in my test file. I don’t know what’s causing it. I’m using typescript

Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("/home/dominic/Code/fire-mission/src/app/solution")' has no compatible call signatures.

Shouldn’t it be something like this?

solution.ts

class FiringSolution {
  public origin: string;
  public target: string;

  constructor(originCoord: string, targetCoord: string) {
    this.origin = originCoord;
    this.target = targetCoord;
  }

  solution(): boolean {
    return true;
  }
}

export default FiringSolution;

solution.spec.ts

import FiringSolution from '../app/solution';

describe('Given the coordinates A1 and C1', () => {
  const fs = new FiringSolution('A1', 'C1)');

  expect(fs.solution()).toBe(true);
});
1 Like