當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript MockBackend.verifyNoPendingRequests方法代碼示例

本文整理匯總了TypeScript中@angular/http/testing.MockBackend.verifyNoPendingRequests方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript MockBackend.verifyNoPendingRequests方法的具體用法?TypeScript MockBackend.verifyNoPendingRequests怎麽用?TypeScript MockBackend.verifyNoPendingRequests使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/http/testing.MockBackend的用法示例。


在下文中一共展示了MockBackend.verifyNoPendingRequests方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should get techs', async(inject([MockBackend, Techs], (mockBackend: MockBackend, techs: Techs) => {
   let conn: MockConnection;
   const response = new Response(new ResponseOptions({body: techsJson}));
   mockBackend.connections.subscribe((connection: MockConnection) => {
     conn = connection;
   });
   techs.getTechs().subscribe((jsonObject => {
     techs.techs = jsonObject;
   }));
   conn.mockRespond(response);
   expect(techs.techs.length).toBe(3);
   mockBackend.verifyNoPendingRequests();
 })));
開發者ID:taureandyerATL,項目名稱:Hack-The-Pay-Gap,代碼行數:13,代碼來源:techs.spec.ts

示例2: it

    it('should get application data and cache it', async(inject([NavService, XHRBackend], (service: NavService, backend: MockBackend) => {
      let count = 0;
      backend.connections.subscribe((connection: MockConnection) => {
        expect(connection.request.method).toBe(RequestMethod.Get);
        expect(connection.request.url).toBe('http://localhost:8080/application');
        connection.mockRespond(new Response(new ResponseOptions({body: '{"expects": "JSON"}', status: 200})));
        count++;
      });

      service.getNavData().subscribe((data: any) => {
        expect(data.expects).toEqual('JSON');
      });
      service.getNavData().subscribe((data: any) => {
        expect(data.expects).toEqual('JSON');
      });

      expect(backend.connectionsArray.length).toBe(1);
      backend.verifyNoPendingRequests();
    })));
開發者ID:Vector-USS,項目名稱:SECCION_4,代碼行數:19,代碼來源:nav.service.spec.ts

示例3: afterEach

 afterEach(() => backend.verifyNoPendingRequests());
開發者ID:onehungrymind,項目名稱:fem-ng2-rest-app,代碼行數:1,代碼來源:items.service.spec.ts

示例4: afterEach

	afterEach(() => {
		mockBackend.resolveAllConnections();
		mockBackend.verifyNoPendingRequests();
	});
開發者ID:emersonbarrion,項目名稱:clean-code-angular2,代碼行數:4,代碼來源:hero.spec.ts

示例5: afterEach

 afterEach(() => {
   mockBackend.verifyNoPendingRequests();
 });
開發者ID:BBoyBreaker,項目名稱:iko-demo,代碼行數:3,代碼來源:quote.service.spec.ts


注:本文中的@angular/http/testing.MockBackend.verifyNoPendingRequests方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。