I have this method inside a class
class Stuff {
constructor() {}
createStuff(stuff) {
const stuffStorage= [];
storage.push(stuff);
return stuffStorage;
}
}
it("should push to stuff array", () => {
// instantiate the class
const stuff = new p.product();
stuff.createStuff();
expect(stuff.createProduct("stuff")).toEqual(["stuff"])
})
The test is passing. At the moment the method does what the test tells it to do. Push stuff to an array. Since I am at the beginning, I wonder if there is a better way of going this. Maybe use mock, on the .push. Any suggestions, please?