本文整理汇总了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);
});
示例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);
});
});