本文整理匯總了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();
})));
示例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();
})));
示例3: afterEach
afterEach(() => backend.verifyNoPendingRequests());
示例4: afterEach
afterEach(() => {
mockBackend.resolveAllConnections();
mockBackend.verifyNoPendingRequests();
});
示例5: afterEach
afterEach(() => {
mockBackend.verifyNoPendingRequests();
});