This is my first time trying JEST and I was wondering how I would write a test for my Length.convert() where I am accounting for "I" or different, but not specifically for "I" and "M". How would I test that specifically?
MY LENGTH CLASS
class Length {
constructor(measure, system) {
this.measure = measure;
this.system = system;
}
convert() {
if (this.system === "I") {
return (this.measure * 2.54).toFixed(2);
} else {
return (this.measure * 0.393701).toFixed(2);
}
}
}
const firstLength = new Length(20, "I");
const secondLength = new Length(7, "M");
console.log(firstLength);
console.log(firstLength.convert());
console.log(secondLength);
console.log(secondLength.convert());
MY JEST TEST
const constructor = require("./length");
const convert = require("./length");
test("", () => {
expect().toBe();
});