Merge "[Launch Instance Fix] Add Keypair Step Unit Tests"
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* jshint globalstrict: true */
|
||||
/*
|
||||
* (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
@@ -18,6 +17,76 @@
|
||||
'use strict';
|
||||
|
||||
describe('Launch Instance Keypair Step', function() {
|
||||
describe('LaunchInstanceKeypairCtrl', function() {
|
||||
var ctrl;
|
||||
|
||||
beforeEach(module('hz.dashboard.launch-instance'));
|
||||
|
||||
beforeEach(inject(function($controller) {
|
||||
var model = { newInstanceSpec: { key_pair: ['key1'] },
|
||||
keypairs: ['key1', 'key2'] };
|
||||
ctrl = $controller('LaunchInstanceKeypairCtrl',
|
||||
{launchInstanceModel: model});
|
||||
}));
|
||||
|
||||
it('contains its general labels', function() {
|
||||
expect(ctrl.label).toBeDefined();
|
||||
expect(Object.keys(ctrl.label).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('contains its table labels', function() {
|
||||
expect(ctrl.tableData).toBeDefined();
|
||||
expect(Object.keys(ctrl.tableData).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('sets table data to appropriate scoped items', function() {
|
||||
expect(ctrl.tableData).toBeDefined();
|
||||
expect(Object.keys(ctrl.tableData).length).toBe(4);
|
||||
expect(ctrl.tableData.available).toEqual(['key1', 'key2']);
|
||||
expect(ctrl.tableData.allocated).toEqual(['key1']);
|
||||
expect(ctrl.tableData.displayedAvailable).toEqual([]);
|
||||
expect(ctrl.tableData.displayedAllocated).toEqual([]);
|
||||
});
|
||||
|
||||
it('defines table details template', function() {
|
||||
expect(ctrl.tableDetails).toBeDefined();
|
||||
});
|
||||
|
||||
it('defines table help', function() {
|
||||
expect(ctrl.tableHelp).toBeDefined();
|
||||
expect(Object.keys(ctrl.tableHelp).length).toBe(1);
|
||||
expect(ctrl.tableHelp.noneAllocText).toBeDefined();
|
||||
});
|
||||
|
||||
it('allows allocation of only one', function() {
|
||||
expect(ctrl.tableLimits).toBeDefined();
|
||||
expect(Object.keys(ctrl.tableLimits).length).toBe(1);
|
||||
expect(ctrl.tableLimits.maxAllocation).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('LaunchInstanceKeypairHelpCtrl', function() {
|
||||
var scope, ctrl;
|
||||
|
||||
beforeEach(module('hz.dashboard.launch-instance'));
|
||||
|
||||
beforeEach(inject(function($controller) {
|
||||
scope = {};
|
||||
ctrl = $controller('LaunchInstanceKeypairHelpCtrl', {$scope:scope});
|
||||
}));
|
||||
|
||||
it('defines the title', function() {
|
||||
expect(ctrl.title).toBeDefined();
|
||||
});
|
||||
|
||||
it('has paragraphs', function() {
|
||||
expect(ctrl.paragraphs).toBeDefined();
|
||||
expect(ctrl.paragraphs.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user