At the end of this I was able to remove the errors, but I do not know if that is good, or it is not good. or, maybe I am close.
My head is confused now:
Iâm using this whole line the way it is:
jasmine.createSpy(âcoverHandlerâ);
Iâm supposed to place that line somewhere in here?
Iâm completely lost.
it("with coverSelector and coverHandler parameters", function() {
manageCover.addCoverHandler(".playb");
expect(coverHandler).toHaveBeenCalled();
});
where we use jasmine.createSpy(âcoverHandlerâ)
I do not understand what that means I need to do.
Me guessing makes things worse:
const coverHandler = jasmine.createSpy();
Expected spy unknown to have been called.
Another attempt: https://jsfiddle.net/qdL3x18r/
I donât know how to stop receiving errors.
it("with coverSelector and coverHandler parameters", function() {
manageCover.addCoverHandler(".playb");
jasmine.createSpy(coverHandler);
expect(coverHandler).toHaveBeenCalled();
});
ReferenceError: coverHandler is not defined
Reading in here makes things even worse because I do not know what I am reading:
https://jasmine.github.io/api/4.0/jasmine.html#.createSpy
(static) createSpy(nameopt, originalFnopt) â {[Spy]
Is this close? https://jsfiddle.net/pa0qnbd1/
it("with coverSelector and coverHandler parameters", function() {
manageCover.addCoverHandler(".playb");
const coverHandler = jasmine.createSpy("coverHandler");
expect(coverHandler).toHaveBeenCalled();
});
Expected spy coverHandler to have been called.
I donât know what that means.
Is this good or close? https://jsfiddle.net/pa0qnbd1/2/
Now there are no errors.
it("with coverSelector and coverHandler parameters", function() {
manageCover.addCoverHandler(".playb");
var coverHandler;
coverHandler = jasmine.createSpy();
coverHandler();
expect(coverHandler).toHaveBeenCalled();
});

Next I placed the html and the css from the broken code into the test code:
Where I receive this error: https://jsfiddle.net/Lp93bqny/
Not sure if I was up to doing this part next:
What is odd here is that, clicking ârunâ sometimes the code passes, other times it fails.
When it fails it reads this:

That error points to this test:
it("when not initialized", function() {
// given
manageCover.init({
container: ".play1",
playButton: ".playa"
});
document.body.classList.remove("initial-fade");
// when
const playButton = document.querySelector(".playb");
simulateClick(playButton);
// then
expect(document.body).not.toHaveClass("initial-fade");
});