I am trying to set up a Mocha and Chai test.
Here is my class, myClass.js:
export default class Myclass {
constructor() {}
sayhello() {
return 'hello';
};
}
Along with a test file, test.myclass.js:
I am attempting to access the method inside the imported class in this way:
import chai from 'chai';
import {sayhello} from 'path_to_sayhello';
let expect = chai.expect;
let assert = chai.assert;
let should = chai.should();
describe.only('hello world', () => {
it('test', () => {
const say = sayhello.add();
say.should.exist;
});
}
The error I'm encountering is that it's saying add is not a function.
What could be the issue here?
And how can I resolve this problem?