Last active
October 19, 2016 16:57
-
-
Save mtho11/e2e78e1da7f2d70c51f7ad3c5215bcec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// from file: manageiq/spec/javascripts/services/middleware_add_datasource_service_spec.js | |
// https://github.com/mtho11/manageiq/blob/3b19676bf461a974946f0fffa8914612dc2568ef/spec/javascripts/services/middleware_add_datasource_service_spec.js#L29-L29 | |
describe('mwAddDataSourceService', function () { | |
var mwAddDataSourceService, httpMock, $http; | |
beforeEach(module('ManageIQ'),function($provide, _$http_){ | |
$http = _$http_; | |
$provide.value('$http', httpMock); | |
spyOn($http, 'post'); | |
// httpMock = jasmine.createSpy($http, ['post']); | |
}); | |
beforeEach(inject(function($injector) { | |
mwAddDataSourceService = $injector.get('mwAddDataSourceService'); | |
})); | |
describe('Test Add Datasource', function() { | |
it('should supply a list of datasources', function () { | |
var dsList = mwAddDataSourceService.getDatasources(); | |
expect(dsList).toBeDefined(); | |
expect(dsList.length).toBeGreaterThan(1); | |
}); | |
it('should submit add_datasource via json/POST', function () { | |
var dsPayload = { | |
'id': 1, | |
'xaDatasource': false, | |
'datasourceName': 'H2DS', | |
'jndiName': 'java:/H2DS', | |
'driverName': 'h2', | |
'driverClass': 'org.h2.Driver', | |
'connectionUrl': 'jdbc:h2:mem:test;DB_CLOSE_DELAY=-1', | |
'userName': 'jdoe', | |
'password': 'password', | |
'securityDomain': '' | |
}; | |
mwAddDataSourceService.sendAddDatasource(dsPayload); | |
expect($http.post).toHaveBeenCalled(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment