I'm trying to write a test on jasmine to check that readline.createInterface() is called, but I keep getting an error that says: TypeError: readline.createInterface is not a function
Here's roughly what I have in a game class:
run() {
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
prompt: 'OHAI> '
});
rl.prompt();
// ... and the rest ...
}
and my test:
describe('run', () => {
it('should create readline interface', () => {
let readline = jasmine.createSpyObj('readline', ['createInterface']);
game.run();
expect(readline.createInterface).toHaveBeenCalled();
});
});
Anyone has a suggestion?
Aucun commentaire:
Enregistrer un commentaire