How to use the angular.mock.module function in angular

To help you get started, we’ve selected a few angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spinnaker / deck / app / scripts / modules / netflix / ci / trigger / manualExecution.handler.spec.ts View on Github external
describe('NetflixGitManualExecutionHandler', () => {

  let $scope: IRootScopeService;
  let executionHandler: NetflixGitManualExecutionHandler;

  beforeEach(mock.module(NETFLIX_GIT_MANUAL_EXECUTION_HANDLER));
  beforeEach(mock.inject(($rootScope: IRootScopeService,
                          netflixCiManualExecutionHandler: NetflixGitManualExecutionHandler) => {
    $scope = $rootScope;
    executionHandler = netflixCiManualExecutionHandler;
  }));

  it('should return the formatted label', (done) => {

    const trigger: IGitTrigger = {
      source: 'triggerSource',
      project: 'triggerProject',
      slug: 'triggerSlug',
      branch: 'triggerBranch',
      enabled: true,
      type: 'git'
    };
github spinnaker / deck / app / scripts / modules / core / serverGroup / details / serverGroupWarningMessage.service.spec.ts View on Github external
describe('serverGroupWarningMessageService', () => {
  let service: ServerGroupWarningMessageService,
      applicationModelBuilder: ApplicationModelBuilder,
      app: Application,
      serverGroup: IServerGroup;

  beforeEach(mock.module(SERVER_GROUP_WARNING_MESSAGE_SERVICE, APPLICATION_MODEL_BUILDER));

  beforeEach(mock.inject((serverGroupWarningMessageService: ServerGroupWarningMessageService,
                          _applicationModelBuilder_: ApplicationModelBuilder) => {
    service = serverGroupWarningMessageService;
    applicationModelBuilder = _applicationModelBuilder_;
    app = applicationModelBuilder.createApplication();
  }));

  describe('addDestroyWarningMessage', () => {
    it('leaves parameters unchanged when additional server groups exist in cluster', () => {
      serverGroup = {
        account: 'test',
        cloudProvider: 'aws',
        cluster: 'foo',
        instanceCounts: { up: 0, down: 0, succeeded: 0, failed: 0, unknown: 0, outOfService: 0, starting: 0 },
        instances: [],
github spinnaker / deck / app / scripts / modules / core / src / application / config / dataSources / applicationDataSourceEditor.component.spec.ts View on Github external
let application: Application,
    $componentController: ng.IComponentControllerService,
    ctrl: DataSourceEditorController,
    $q: ng.IQService,
    $scope: ng.IScope;

  const initialize = () => {
    ctrl = $componentController(
      'applicationDataSourceEditor',
      { $scope: null },
      { application },
    ) as DataSourceEditorController;
    ctrl.$onInit();
  };

  beforeEach(mock.module(APPLICATION_DATA_SOURCE_EDITOR));

  beforeEach(
    mock.inject(
      (
        _$componentController_: ng.IComponentControllerService,
        _$q_: ng.IQService,
        $rootScope: ng.IRootScopeService,
      ) => {
        $componentController = _$componentController_;
        $q = _$q_;
        $scope = $rootScope.$new();
      },
    ),
  );

  beforeEach(() => {
github spinnaker / deck / app / scripts / modules / amazon / src / serverGroup / serverGroup.transformer.spec.ts View on Github external
describe('awsServerGroupTransformer', () => {
  let transformer: AwsServerGroupTransformer, $q: IQService, $scope: IScope;

  beforeEach(mock.module(AWS_SERVER_GROUP_TRANSFORMER));

  beforeEach(
    mock.inject(
      (_awsServerGroupTransformer_: AwsServerGroupTransformer, _$q_: IQService, $rootScope: IRootScopeService) => {
        transformer = _awsServerGroupTransformer_;
        $q = _$q_;
        $scope = $rootScope.$new();
      },
    ),
  );

  describe('normalize server group', () => {
    beforeEach(() => {
      spyOn(VpcReader, 'listVpcs').and.returnValue(
        $q.when([{ account: 'test', region: 'us-east-1', id: 'vpc-1', name: 'main' }]),
      );
github spinnaker / deck / app / scripts / modules / google / src / securityGroup / securityGroupHelpText.service.spec.ts View on Github external
describe('Service: gceSecurityGroupHelpTextService', () => {
  let $q: ng.IQService;
  let gceSecurityGroupHelpTextService: GceSecurityGroupHelpTextService;
  let application: any;

  beforeEach(mock.module(GCE_SECURITY_GROUP_HELP_TEXT_SERVICE));

  beforeEach(
    mock.inject(
      (
        _gceSecurityGroupHelpTextService_: GceSecurityGroupHelpTextService,
        _$q_: ng.IQService,
        _$timeout_: ng.ITimeoutService,
      ) => {
        gceSecurityGroupHelpTextService = _gceSecurityGroupHelpTextService_;
        $q = _$q_;
        const $timeout = _$timeout_;

        application = {
          ready: () => $q.resolve(),
          getDataSource: () => {
            return {
github spinnaker / deck / app / scripts / modules / core / forms / numberList / numberList.component.spec.ts View on Github external
describe('Component: numberList', () => {

  let $compile: ng.ICompileService,
      model: number[],
      stringModel: string,
      $scope: ng.IScope,
      elem: any,
      constraints: NumberListConstraints,
      onChange: () => any;

  beforeEach(mock.module(NUMBER_LIST_COMPONENT));

  beforeEach(mock.inject((_$compile_: ng.ICompileService, $rootScope: ng.IScope) => {
    $compile = _$compile_;
    $scope = $rootScope.$new();
  }));

  const initialize = (startModel: number[]) => {
    model = startModel;
    $scope['data'] = {
      model: startModel,
      constraints: constraints,
      onChange: onChange,
    };
    if (stringModel) {
      $scope['data'].model = stringModel;
    }
github spinnaker / deck / app / scripts / modules / core / src / forms / numberList / numberList.component.spec.ts View on Github external
describe('Component: numberList', () => {
  let $compile: ng.ICompileService,
    model: number[],
    stringModel: string,
    $scope: ng.IScope,
    elem: any,
    constraints: INumberListConstraints,
    onChange: () => any;

  beforeEach(mock.module(NUMBER_LIST_COMPONENT));

  beforeEach(
    mock.inject((_$compile_: ng.ICompileService, $rootScope: ng.IScope) => {
      $compile = _$compile_;
      $scope = $rootScope.$new();
    }),
  );

  const initialize = (startModel: number[]) => {
    model = startModel;
    $scope['data'] = {
      model: startModel,
      constraints,
      onChange,
    };
    if (stringModel) {
github spinnaker / deck / app / scripts / modules / oracle / src / loadBalancer / details / loadBalancerDetail.controller.spec.ts View on Github external
let $scope: IScope;
  let $state: StateService;
  let securityGroupReader: SecurityGroupReader;
  let confirmationModalService: ConfirmationModalService;
  let loadBalancerReader: LoadBalancerReader;

  const loadBalancer = {
    name: 'foo',
    region: 'us-west-1',
    account: 'test',
    accountId: 'test',
    vpcId: '1',
  };

  beforeEach(
    mock.module(
      ORACLE_LOAD_BALANCER_DETAIL_CONTROLLER,
      SECURITY_GROUP_READER,
      LOAD_BALANCER_READ_SERVICE,
      CONFIRMATION_MODAL_SERVICE,
    ),
  );

  beforeEach(
    mock.inject(
      (
        $controller: IControllerService,
        $rootScope: IRootScopeService,
        _$state_: StateService,
        _securityGroupReader_: SecurityGroupReader,
        _confirmationModalService_: ConfirmationModalService,
        _loadBalancerReader_: LoadBalancerReader,
github spinnaker / deck / app / scripts / modules / ecs / src / serverGroup / serverGroup.transformer.spec.ts View on Github external
describe('ecsServerGroupTransformer', () => {
  let transformer: EcsServerGroupTransformer, $q: IQService, $scope: IScope;

  beforeEach(mock.module(ECS_SERVER_GROUP_TRANSFORMER));

  beforeEach(
    mock.inject(
      (_ecsServerGroupTransformer_: EcsServerGroupTransformer, _$q_: IQService, $rootScope: IRootScopeService) => {
        transformer = _ecsServerGroupTransformer_;
        $q = _$q_;
        $scope = $rootScope.$new();
      },
    ),
  );

  describe('normalize server group', () => {
    beforeEach(() => {
      spyOn(VpcReader, 'listVpcs').and.returnValue(
        $q.when([{ account: 'test', region: 'us-east-1', id: 'vpc-1', name: 'main' }]),
      );
github spinnaker / deck / app / scripts / modules / core / src / application / service / ApplicationReader.spec.ts View on Github external
describe('ApplicationReader', function() {
  let securityGroupReader: SecurityGroupReader;
  let loadBalancerReader: any;
  let clusterService: ClusterService;
  let $q: ng.IQService;
  let $scope: ng.IScope;

  beforeEach(() => ApplicationDataSourceRegistry.clearDataSources());

  beforeEach(
    mock.module(
      SECURITY_GROUP_DATA_SOURCE,
      SERVER_GROUP_DATA_SOURCE,
      LOAD_BALANCER_DATA_SOURCE,
      SECURITY_GROUP_READER,
      CLUSTER_SERVICE,
      LOAD_BALANCER_READ_SERVICE,
    ),
  );

  beforeEach(
    mock.inject(function(
      _securityGroupReader_: SecurityGroupReader,
      _clusterService_: ClusterService,
      _$q_: ng.IQService,
      _loadBalancerReader_: LoadBalancerReader,
      $rootScope: ng.IRootScopeService,