当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IHttpBackendService.flush方法代码示例

本文整理汇总了TypeScript中angular.IHttpBackendService.flush方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IHttpBackendService.flush方法的具体用法?TypeScript IHttpBackendService.flush怎么用?TypeScript IHttpBackendService.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular.IHttpBackendService的用法示例。


在下文中一共展示了IHttpBackendService.flush方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('rejects if execution retrieval fails', () => {
      const executionId = 'abc';
      const url = [SETTINGS.gateUrl, 'pipelines', executionId].join('/');
      let succeeded = false;
      let failed = false;

      $httpBackend.expectGET(url).respond(200, { thingToMatch: false });

      executionService.waitUntilExecutionMatches(executionId, (execution) => (execution as any).thingToMatch)
        .then(() => succeeded = true, () => failed = true);

      expect(succeeded).toBe(false);
      expect(failed).toBe(false);

      $httpBackend.flush();

      // no match, retrying
      expect(succeeded).toBe(false);
      expect(failed).toBe(false);
      $httpBackend.expectGET(url).respond(500, '');
      timeout.flush();
      $httpBackend.flush();
      expect(succeeded).toBe(false);
      expect(failed).toBe(true);
    });
开发者ID:robfletcher,项目名称:deck,代码行数:25,代码来源:execution.service.spec.ts

示例2: it

    it('should wait until task is gone, then resolve', () => {
      const taskId = 'abc';
      const deleteUrl = [API.baseUrl, 'tasks', taskId].join('/');
      const checkUrl = [API.baseUrl, 'tasks', taskId].join('/');
      let completed = false;

      $httpBackend.expectDELETE(deleteUrl).respond(200, []);

      taskWriter.deleteTask(taskId).then(() => completed = true);

      // first check: task is still present
      $httpBackend.expectGET(checkUrl).respond(200, [{id: taskId}]);
      $httpBackend.flush();
      expect(completed).toBe(false);

      // second check: task retrieval returns some error, try again
      $httpBackend.expectGET(checkUrl).respond(500, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(false);

      // third check: task is not present, should complete
      $httpBackend.expectGET(checkUrl).respond(404, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(true);
    });
开发者ID:jcwest,项目名称:deck,代码行数:27,代码来源:task.write.service.spec.ts

示例3: it

 it('returns an empty list instead of failing if tags cannot be loaded', () => {
   $http.whenGET(`${SETTINGS.gateUrl}/tags?entityId=a,b&entityType=servergroups&maxResults=2`).respond(400, 'bad request');
   let result: any = null;
   service.getAllEntityTags('serverGroups', ['a', 'b']).then(r => result = r);
   $http.flush();
   $timeout.flush();
   $http.flush();
   expect(result).toEqual([]);
 });
开发者ID:jcwest,项目名称:deck,代码行数:9,代码来源:entityTags.read.service.spec.ts

示例4: it

  it('adds label to subnet, including (deprecated) if deprecated field is true', function() {
    $http
      .whenGET(API.baseUrl + '/subnets')
      .respond(200, [
        { purpose: 'internal', deprecated: true },
        { purpose: 'external', deprecated: false },
        { purpose: 'internal' },
      ]);

    let result: ISubnet[] = null;

    SubnetReader.listSubnets().then((subnets: ISubnet[]) => {
      result = subnets;
    });

    $http.flush();
    $scope.$digest();

    expect(result[0].label).toBe('internal (deprecated)');
    expect(result[0].deprecated).toBe(true);
    expect(result[1].label).toBe('external');
    expect(result[1].deprecated).toBe(false);
    expect(result[2].label).toBe('internal');
    expect(result[2].deprecated).toBe(false);
  });
开发者ID:emjburns,项目名称:deck,代码行数:25,代码来源:subnet.read.service.spec.ts

示例5: it

  it('should return the build config', () => {
    const buildId = 'bc_bid';
    $http.expectGET(`${CI_BUILD_URL}/${buildId}/config`).respond(200, {});

    ciBuildReader.getBuildConfig(buildId);
    $http.flush();
  });
开发者ID:brujoand,项目名称:deck,代码行数:7,代码来源:ciBuild.read.service.spec.ts

示例6: it

  it('should return a non-empty array when configured to do so and invoked', () => {
    const services: IPagerDutyService[] = [
      {
        name: 'one',
        integration_key: 'one_key',
        id: '1',
        policy: 'ABCDEF',
        lastIncidentTimestamp: '1970',
        status: 'active',
      },
      {
        name: '2',
        integration_key: 'two_key',
        id: '2',
        policy: 'ABCDEG',
        lastIncidentTimestamp: '1970',
        status: 'active',
      },
    ];
    $http.whenGET(`${API.baseUrl}/pagerDuty/services`).respond(200, services);

    let executed = false;
    PagerDutyReader.listServices().subscribe((pagerDutyServices: IPagerDutyService[]) => {
      expect(pagerDutyServices).toBeDefined();
      expect(pagerDutyServices.length).toBe(2);
      executed = true; // can't use done() function b/c $digest is already in progress
    });

    $http.flush();
    expect(executed).toBeTruthy();
  });
开发者ID:emjburns,项目名称:deck,代码行数:31,代码来源:pagerDuty.read.service.spec.ts

示例7: it

    it('returns null when gist fetch fails', () => {
      let result: IWhatsNewContents = { contents: 'fail', lastUpdated: 'never' };
      $http.expectGET(url).respond(404, {});
      WhatsNewReader.getWhatsNewContents().then(data => (result = data));
      $http.flush();

      expect(result).toBeNull();
    });
开发者ID:emjburns,项目名称:deck,代码行数:8,代码来源:whatsNew.read.service.spec.ts


注:本文中的angular.IHttpBackendService.flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。