當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。