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


TypeScript subnet.read.service.SubnetReader类代码示例

本文整理汇总了TypeScript中core/subnet/subnet.read.service.SubnetReader的典型用法代码示例。如果您正苦于以下问题:TypeScript read.service.SubnetReader类的具体用法?TypeScript read.service.SubnetReader怎么用?TypeScript read.service.SubnetReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: 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

示例2: describe

describe('subnetReader', function() {

  let service: SubnetReader,
      $http: ng.IHttpBackendService,
      $scope: ng.IScope,
      API: Api;

  beforeEach(
    mock.module(
      API_SERVICE,
      SUBNET_READ_SERVICE
    )
  );

  beforeEach(mock.inject(function ($httpBackend: ng.IHttpBackendService, $rootScope: ng.IRootScopeService, _subnetReader_: SubnetReader, _API_: Api) {
    API = _API_;
    service = _subnetReader_;
    $http = $httpBackend;
    $scope = $rootScope.$new();
  }));


  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;

    service.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:jcwest,项目名称:deck,代码行数:46,代码来源:subnet.read.service.spec.ts


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