Update JS unittests to use a deferred to mock ajax calls