本文整理汇总了TypeScript中core/application/applicationModel.builder.ApplicationModelBuilder.createApplicationForTests方法的典型用法代码示例。如果您正苦于以下问题:TypeScript builder.ApplicationModelBuilder.createApplicationForTests方法的具体用法?TypeScript builder.ApplicationModelBuilder.createApplicationForTests怎么用?TypeScript builder.ApplicationModelBuilder.createApplicationForTests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/application/applicationModel.builder.ApplicationModelBuilder
的用法示例。
在下文中一共展示了builder.ApplicationModelBuilder.createApplicationForTests方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('adds firewall names across accounts, falling back to the ID if none found', function() {
let details: ISecurityGroupDetail = null;
const application: Application = ApplicationModelBuilder.createApplicationForTests('app');
application['securityGroupsIndex'] = {
test: { 'us-east-1': { 'sg-2': { name: 'matched' } } },
prod: { 'us-east-1': { 'sg-2': { name: 'matched-prod' } } },
};
$http.expectGET(`${API.baseUrl}/securityGroups/test/us-east-1/sg-123?provider=aws&vpcId=vpc-1`).respond(200, {
inboundRules: [
{ securityGroup: { accountName: 'test', id: 'sg-345' } },
{ securityGroup: { accountName: 'test', id: 'sg-2' } },
{ securityGroup: { accountName: 'prod', id: 'sg-2' } },
],
region: 'us-east-1',
});
reader
.getSecurityGroupDetails(application, 'test', 'aws', 'us-east-1', 'vpc-1', 'sg-123')
.then(result => (details = result));
$http.flush();
expect(details.securityGroupRules.length).toBe(3);
expect(details.securityGroupRules[0].securityGroup.name).toBe('sg-345');
expect(details.securityGroupRules[0].securityGroup.inferredName).toBe(true);
expect(details.securityGroupRules[1].securityGroup.name).toBe('matched');
expect(details.securityGroupRules[1].securityGroup.inferredName).toBeFalsy();
expect(details.securityGroupRules[2].securityGroup.name).toBe('matched-prod');
expect(details.securityGroupRules[2].securityGroup.inferredName).toBeFalsy();
});
示例2: it
it('gets all accounts, then adds wildcard and regions per account to vm', () => {
const accounts: any = [
{ name: 'prod', regions: [{ name: 'us-east-1' }, { name: 'us-west-1' }] },
{ name: 'test', regions: [{ name: 'us-west-2' }, { name: 'eu-west-1' }] },
];
spyOn(AccountService, 'listAllAccounts').and.returnValue($q.when(accounts));
initializeController(null);
$ctrl.application = ApplicationModelBuilder.createApplicationForTests('app', {
key: 'serverGroups',
loader: () => $q.resolve([]),
onLoad: (_app, data) => $q.resolve(data),
});
$ctrl.application.serverGroups.refresh();
$scope.$digest();
$ctrl.config = new ChaosMonkeyConfig($ctrl.application.attributes.chaosMonkey || {});
$ctrl.$onInit();
$scope.$digest();
expect($ctrl.accounts).toEqual([accounts[0], accounts[1]]);
expect($ctrl.regionsByAccount).toEqual({
prod: ['*', 'us-east-1', 'us-west-1'],
test: ['*', 'us-west-2', 'eu-west-1'],
});
});
示例3: beforeEach
beforeEach(() => {
application = ApplicationModelBuilder.createApplicationForTests(
'app',
{
key: 'optionalSource',
optional: true,
visible: true,
},
{
key: 'invisibleSource',
visible: false,
},
{
key: 'requiredSource',
visible: true,
},
{
key: 'optInSource',
optional: true,
visible: true,
optIn: true,
},
);
application.getDataSource('optInSource').disabled = true;
application.attributes = { accounts: ['test'] };
});
示例4: it
it('sets error when task fails while polling', () => {
let completeCalled = false;
const task = { id: 'a', status: 'RUNNING' } as ITask;
OrchestratedItemTransformer.defineProperties(task);
const operation = () => $q.when(task);
const monitor = new TaskMonitor({
application: ApplicationModelBuilder.createApplicationForTests('app', { key: 'runningTasks', lazy: true }),
title: 'a task',
modalInstance: { result: $q.defer().promise } as IModalServiceInstance,
onTaskComplete: () => (completeCalled = true),
});
monitor.submit(operation);
expect(monitor.submitting).toBe(true);
expect(monitor.error).toBe(false);
$timeout.flush(); // still running first time
$http.expectGET([API.baseUrl, 'tasks', 'a'].join('/')).respond(200, { status: 'RUNNING' });
$timeout.flush();
$http.flush();
expect(monitor.task.isCompleted).toBe(false);
$http.expectGET([API.baseUrl, 'tasks', 'a'].join('/')).respond(200, { status: 'TERMINAL' });
$timeout.flush(); // complete second time
$http.flush();
expect(monitor.submitting).toBe(false);
expect(monitor.error).toBe(true);
expect(monitor.errorMessage).toBe('There was an unknown server error.');
expect(completeCalled).toBe(false);
});
示例5: configureApplication
function configureApplication() {
ApplicationDataSourceRegistry.registerDataSource({ key: 'serverGroups' });
application = ApplicationModelBuilder.createApplicationForTests(
'app',
...ApplicationDataSourceRegistry.getDataSources(),
);
application.refresh();
$scope.$digest();
}
示例6:
this.buildApplication = (json: any) => {
const app = ApplicationModelBuilder.createApplicationForTests('app', { key: 'serverGroups', lazy: true });
if (json.serverGroups) {
app.getDataSource('serverGroups').data = _.cloneDeep(json.serverGroups.data);
}
if (json.clusters) {
app.clusters = json.clusters;
}
return app;
};
示例7: beforeEach
beforeEach(() => {
const application: Application = ApplicationModelBuilder.createApplicationForTests(
'app',
...ApplicationDataSourceRegistry.getDataSources(),
);
command = {
viewState: {
mode: 'create',
},
application: application.name,
} as IServerGroupCommand;
});
示例8: beforeEach
beforeEach(() => {
hasValue = false;
accounts = [];
delete SETTINGS.defaultProvider;
application = ApplicationModelBuilder.createApplicationForTests('app');
application.attributes = { cloudProviders: 'testProvider' };
config = {
name: 'testProvider',
securityGroup: {},
};
});