https://jsfiddle.net/8vbug3qh/
expectation is that it throws an error.
This would be changed to what?
expect(player.i.h.width).toBeGreaterThan(0);
it("addPlayer requires a video element", function() {
//given
player = undefined;
//when
videoPlayer.addPlayer("DIV");
//then
expect(player.i.h.width).toBeGreaterThan(0);
});
I have this old set of tests where I can see how I did some of the things. https://jsfiddle.net/jbced2uk/1/
expect(fnCall).toThrowError(/Cannot read properties of undefined/);
I did this wrong: I don’t know if it can be fixed.
.toThrowError
part seems top be right.
Am I able to get this to be right?
https://jsfiddle.net/t3s2aL1x/
it("addPlayer requires a video element", function() {
//given
player = undefined;
//when
videoPlayer.addPlayer("DIV");
//then
const fnCall = () => videoPlayer.addPlayer();
expect(fnCall).toThrowError(/Cannot read properties of undefined/)
});
Here is another try: https://jsfiddle.net/t3s2aL1x/3/
it("addPlayer requires a video element", function() {
//given
player = undefined;
//when
videoPlayer.addPlayer("DIV");
//then
expect(player).toThrowError(/Cannot read properties of undefined/);
});
Here is another try: https://jsfiddle.net/t3s2aL1x/5/
it("addPlayer requires a video element", function() {
//given
player = undefined;
//when
videoPlayer.addPlayer("DIV");
//then
expect(videoPlayer.addPlayer).toThrowError(/Cannot read properties of undefined/);
});
Are any of these almost good where I would just need to make some changes to it?