Fix jasmine test failures due to missing ngRoute, schema-form dep

Resource Browser panel 2 jasmine test failure.
Fix 2 tests with no expectation for http.spec.js.
Remove undefined magic_search.js path in jasmine.html.
Fix missing expectations in create.action.service.spec.js.
Fix some formatting.

Open up console for localhost:<port>/jasmine/ before and
after this patch to see the errors.

Change-Id: I0ebd25dc50c2310e23ce8fed8f2a1adebc64ad15
Closes-Bug: #1615055
This commit is contained in:
Cindy Lu 2016-07-29 14:46:05 -07:00
parent b8e89bcf54
commit 89efd7f6f6
6 changed files with 24 additions and 14 deletions

View File

@ -97,16 +97,28 @@
describe('WEBROOT handling', function() {
it('respects WEBROOT by default', function() {
var expectedUrl = WEBROOT + 'good';
var $scope = {};
$httpBackend.when('GET', expectedUrl).respond(200, '');
$httpBackend.expect('GET', expectedUrl);
api.get('/good');
api.get('/good').success(function() {
$scope.success = true;
});
$httpBackend.flush();
expect($scope.success).toBe(true);
});
it('ignores WEBROOT with external = true flag', function() {
var expectedUrl = '/good';
var $scope = {};
$httpBackend.when('GET', expectedUrl).respond(200, '');
$httpBackend.expect('GET', expectedUrl);
api.get('/good', {external: true});
api.get('/good', {external: true}).success(function() {
$scope.success = true;
});
$httpBackend.flush();
expect($scope.success).toBe(true);
});
});

View File

@ -31,9 +31,6 @@
expect(angular.module('schemaForm')).toBeDefined();
});
it('should build tabs correctly', function() {
});
it('should define messages for all the error codes', function() {
// We don't need to check the specifics of each message in a test,
// but we should check they all exist

View File

@ -29,9 +29,6 @@
<script src='{{ STATIC_URL }}{{ file }}'></script>
{% endfor %}
<!-- Magic Search library must be after magic-search override widget -->
<script src="{{ STATIC_URL }}horizon/lib/magic_search/magic_search.js"></script>
{% block source %}
{% endblock %}

View File

@ -40,7 +40,7 @@
* @description Base path for the developer dashboard
*/
function config($provide, $windowProvider) {
var path = $windowProvider.$get().STATIC_URL + 'dashboard/developer/';
$provide.constant('horizon.dashboard.developer.basePath', path);
var path = $windowProvider.$get().STATIC_URL + 'dashboard/developer/';
$provide.constant('horizon.dashboard.developer.basePath', path);
}
})();

View File

@ -24,8 +24,9 @@
* Dashboard module for the resource-browser panel.
*/
angular
.module('horizon.dashboard.developer.resource-browser', [], config)
.constant('horizon.dashboard.developer.resource-browser.BASE_ROUTE', 'developer/resource_browser/');
.module('horizon.dashboard.developer.resource-browser', ['ngRoute', 'schemaForm'], config)
.constant('horizon.dashboard.developer.resource-browser.BASE_ROUTE',
'developer/resource_browser/');
config.$inject = [
'$windowProvider',
@ -43,4 +44,4 @@
});
}
})();
})();

View File

@ -199,7 +199,7 @@
source_type: 'url', image_url: 'http://somewhere'});
});
it('should raise event even if update meta data fails', function() {
it('should raise event even if update metadata fails', function() {
var image = { name: 'Test', id: '2' };
var failedPromise = function() {
return {
@ -225,6 +225,9 @@
var modalArgs = wizardModalService.modal.calls.argsFor(0)[0];
modalArgs.submit();
$scope.$apply();
expect($scope.$emit).toHaveBeenCalledWith(
'horizon.app.core.images.IMAGE_METADATA_CHANGED', undefined);
});
it('should destroy the event watchers', function() {