Wrote Widget unit tests

* Move calendar-api-mock.js so both e2e and unit tests can access it
* Check to see if variables exist before referencing them