Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application services tab #1237

Merged
merged 36 commits into from
Sep 15, 2017
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c2534d8
Duplicate application service tab as a base for service catalogue
KlapTrap Aug 22, 2017
bfdbd23
Add seperate cards for service catalogue and service tabs
KlapTrap Aug 22, 2017
82b8b41
Fetch and display service instances on application service tab
KlapTrap Aug 22, 2017
71f836f
Ensure both application service tab and service catalogue tab are usi…
KlapTrap Aug 22, 2017
a5512d1
Add relevent fields to services tab cards
KlapTrap Aug 23, 2017
ef6788d
Update service card and properly unbind service instance
KlapTrap Aug 23, 2017
4b07049
Add all management command to the service instance tab
KlapTrap Aug 23, 2017
64a1b81
Manage instance now restricts the instance page by service type
KlapTrap Aug 23, 2017
f4ffbe3
Fix binding filtering and rename service catalogue directives
KlapTrap Aug 24, 2017
cb7e25b
Tidy up i18n and error messages in service and service catalogue pages
KlapTrap Aug 24, 2017
bb1899a
Show friendly message when filtering instances via service catalogue …
KlapTrap Aug 24, 2017
8b7e89e
Changed the application Services tab to Service Instance
KlapTrap Aug 24, 2017
86e2fec
Fixed application services filter clear link click handler
KlapTrap Aug 24, 2017
dbc37c4
Add service count to app summary page and move detach from the action…
KlapTrap Aug 24, 2017
f3b934c
Changed app summary service count string to be inline with surroundin…
KlapTrap Aug 24, 2017
c7d7d3c
Added a couple of comment to services module
KlapTrap Aug 24, 2017
f2713ad
Fixed service card test
KlapTrap Aug 24, 2017
c2385b5
Removed unused manage services module
KlapTrap Aug 24, 2017
ca2191a
Add/fix tests for service tabs
KlapTrap Aug 25, 2017
3ea4f3b
Comvert callback to promise
KlapTrap Aug 25, 2017
c4953bf
Merge branch 'master' into application-services-tab
KlapTrap Aug 25, 2017
3c015d8
Fixed e2e tests
KlapTrap Aug 29, 2017
b916f3c
Merge branch 'master' into application-services-tab
KlapTrap Aug 29, 2017
6f0b4f6
Linting
KlapTrap Aug 29, 2017
a2967dc
Fixed linting and unit tests
KlapTrap Sep 6, 2017
531e483
Merge branch 'master' into application-services-tab
KlapTrap Sep 11, 2017
f9c3fc4
Translated all the things and fixed minor styling issues after PR review
KlapTrap Sep 11, 2017
7875705
Merge branch 'master' into application-services-tab
KlapTrap Sep 12, 2017
6ca40e8
Fixed linting failures from master
KlapTrap Sep 12, 2017
790df8e
Merge remote-tracking branch 'origin/master' into application-service…
nwmac Sep 12, 2017
1f6f744
Merge remote-tracking branch 'origin/master' into application-service…
nwmac Sep 13, 2017
1b8ff97
Fix lint issues
nwmac Sep 13, 2017
72f616e
Merge remote-tracking branch 'origin/master' into application-service…
nwmac Sep 14, 2017
bf94e14
Fixes for failing e2e tests
nwmac Sep 15, 2017
86463a7
Fix localisation of catalogue
nwmac Sep 15, 2017
666b54b
Small fixes
richard-cox Sep 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed service card test
  • Loading branch information
KlapTrap committed Aug 24, 2017
commit f2713ad2fb72cfa82703a00ca188d88400f0a004
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(function () {
'use strict';

describe('service-card directive', function () {
var $compile, $httpBackend, $scope, mockBindingsApi, appEventService, cfServiceInstanceService;
fdescribe('service-card directive', function () {
var $compile, $httpBackend, $scope, mockBindingsApi;

var cnsiGuid = 'cnsiGuid';
var spaceGuid = 'spaceGuid';
Expand All @@ -15,8 +15,6 @@
$httpBackend = $injector.get('$httpBackend');
$scope = $injector.get('$rootScope').$new();
var modelManager = $injector.get('modelManager');
appEventService = $injector.get('appEventService');
cfServiceInstanceService = $injector.get('cfServiceInstanceService');

if (mockAuthModel) {
var authModel = modelManager.retrieve('cloud-foundry.model.auth');
Expand Down Expand Up @@ -80,31 +78,28 @@
var serviceCardCtrl, element;

beforeEach(function () {
var markup = '<service-card app="app" cnsi-guid="guid" service="service">' +
'</service-card>';
var markup = '<service-catalogue-card app="app" cnsi-guid="guid" service="service">' +
'</service-catalogue-card>';
element = angular.element(markup);
$compile(element)($scope);

$scope.$apply();
$httpBackend.flush();

serviceCardCtrl = element.controller('serviceCard');
serviceCardCtrl = element.controller('serviceCatalogueCard');
});

it('should be defined and initialized', function () {
expect(element).toBeDefined();
expect(serviceCardCtrl).toBeDefined();

expect(serviceCardCtrl.serviceBindings).not.toEqual([]);
expect(serviceCardCtrl.numAttached).toBe(1);
expect(serviceCardCtrl.actions.length).toBe(3);
});

describe('init', function () {
beforeEach(function () {
spyOn(serviceCardCtrl, 'getServiceInstanceGuids').and.callThrough();
spyOn(serviceCardCtrl, 'getServiceBindings').and.callThrough();
spyOn(serviceCardCtrl, 'updateActions').and.callThrough();
});

afterAll(function () {
Expand All @@ -123,9 +118,6 @@
it('should set serviceBindings', function () {
serviceCardCtrl.init().then(function () {
expect(serviceCardCtrl.serviceBindings.length).toBe(1);
expect(serviceCardCtrl.numAttached).toBe(1);
expect(serviceCardCtrl.actions[1].hidden).toBeFalsy();
expect(serviceCardCtrl.actions[2].hidden).toBeFalsy();
});

$httpBackend.flush();
Expand All @@ -140,55 +132,8 @@

expect(serviceCardCtrl.serviceBindings.length).toBe(0);
expect(serviceCardCtrl.numAttached).toBe(0);
expect(serviceCardCtrl.actions[1].hidden).toBeTruthy();
expect(serviceCardCtrl.actions[2].hidden).toBeTruthy();
expect(serviceCardCtrl.getServiceInstanceGuids).toHaveBeenCalled();
expect(serviceCardCtrl.getServiceBindings).not.toHaveBeenCalled();
expect(serviceCardCtrl.updateActions).toHaveBeenCalled();
});
});

describe('addService', function () {
it('should emit cf.events.START_ADD_SERVICE_WORKFLOW event', function () {
spyOn(appEventService, '$emit');
serviceCardCtrl.addService();
expect(appEventService.$emit).toHaveBeenCalled();

var args = appEventService.$emit.calls.mostRecent().args;
expect(args[0]).toBe('cf.events.START_ADD_SERVICE_WORKFLOW');
});
});

describe('detach', function () {
it('should call unbindServiceFromApp', function () {
spyOn(cfServiceInstanceService, 'unbindServiceFromApp');
serviceCardCtrl.detach();
expect(cfServiceInstanceService.unbindServiceFromApp)
.toHaveBeenCalled();
var args = cfServiceInstanceService.unbindServiceFromApp.calls.argsFor(0);
expect(args[0]).toBe('guid');
expect(args[1]).toBe('6e23689c-2844-4ebf-ab69-e52ab3439f6b');
expect(args[2]).toBe('571b283b-97f9-41e3-abc7-81792ee34e40');
expect(args[3]).toBe('instance_123');
});

it('should not call unbindServiceFromApp if no services attached', function () {
spyOn(cfServiceInstanceService, 'unbindServiceFromApp');
serviceCardCtrl.serviceBindings.length = 0;
serviceCardCtrl.detach();
expect(cfServiceInstanceService.unbindServiceFromApp)
.not.toHaveBeenCalled();
});
});

describe('manageInstances', function () {
it('should emit cf.START_MANAGE_SERVICES event', function () {
spyOn(appEventService, '$emit');
serviceCardCtrl.manageInstances();
expect(appEventService.$emit).toHaveBeenCalled();

var args = appEventService.$emit.calls.mostRecent().args;
expect(args[0]).toBe('cf.events.START_MANAGE_SERVICES');
});
});
});
Expand All @@ -204,7 +149,7 @@
});

describe('with defaults', function () {
var serviceCardCtrl, element;
var element;

beforeEach(function () {
var markup = '<service-card app="app" cnsi-guid="cnsiGuid" service="service">' +
Expand All @@ -217,13 +162,6 @@

serviceCardCtrl = element.controller('serviceCard');
});

it('should display service actions', function () {
expect(element).toBeDefined();
expect(serviceCardCtrl).toBeDefined();
expect(serviceCardCtrl.hideServiceActions()).toBe(false);
});

});
});

Expand All @@ -238,7 +176,7 @@
});

describe('with defaults', function () {
var serviceCardCtrl, element;
var element;

beforeEach(function () {
var markup = '<service-card app="app" cnsi-guid="cnsiGuid" service="service">' +
Expand All @@ -251,13 +189,6 @@

serviceCardCtrl = element.controller('serviceCard');
});

it('should disable service actions', function () {
expect(element).toBeDefined();
expect(serviceCardCtrl).toBeDefined();
expect(serviceCardCtrl.hideServiceActions()).toBe(true);
});

});
});
});
Expand Down