Adding tests to video player code

No, the tests are not ready for that yet.

Yes, the tests pass, but they’re not complete. Here’s what we currently have:

  • :white_check_mark: init needs a function parameter
  • :white_check_mark: init container with a single container
  • :white_check_mark: init container with multiple containers
  • :white_check_mark: init playButton when not initialized
  • :white_check_mark: init playButton with one playButton
  • :white_check_mark: init playButton with all playButtons
  • :white_check_mark: addCoverHandler needs coverSelector
  • :white_check_mark: addCoverHandler with coverSelector and coverHandler

The tests are passing, but are they any good?

Crosschecks now need to occur, where we check two things:

  • Can any of the test code (mainly the when section) be commented out, and the tests still pass?
  • Can any of the manageCover code be commented out, and the tests still pass?

Both of those a problems that need to be fixed, and the code at https://jsfiddle.net/3n9fxjuc/1/ has both of those problems.

Here are the problems that I found with a few simple checks:

  • The single-container test is currently broken, because it shows a pass when it shouldn’t.
  • The multiple-containers test is currently broken, because it shows a pass when it shouldn’t.
  • The showCover() code in manageCover is not yet being tested at all

That gives us an updated list of the following:

  • :white_check_mark: init needs a function parameter
  • :x: init container with a single container
  • :x: init container with multiple containers
  • :x: fails to check showCover() code
  • :white_check_mark: init playButton when not initialized
  • :white_check_mark: init playButton with one playButton
  • :white_check_mark: init playButton with all playButtons
  • :white_check_mark: addCoverHandler needs coverSelector
  • :white_check_mark: addCoverHandler with coverSelector and coverHandler

We’re made some good progress, but there’s a way to go yet before the tests are ready to be used.

The first issue is experienced in the single container test, just by commenting out the simulateAnimationEnd line. That’s the first problem that needs to be fixed. With that line commented out, it must show a fail instead.