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


TypeScript IHttpBackendService.expectDELETE方法代碼示例

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


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

示例1: it

    it('should wait until task is gone, then resolve', () => {
      const taskId = 'abc';
      const deleteUrl = [API.baseUrl, 'tasks', taskId].join('/');
      const checkUrl = [API.baseUrl, 'tasks', taskId].join('/');
      let completed = false;

      $httpBackend.expectDELETE(deleteUrl).respond(200, []);

      taskWriter.deleteTask(taskId).then(() => completed = true);

      // first check: task is still present
      $httpBackend.expectGET(checkUrl).respond(200, [{id: taskId}]);
      $httpBackend.flush();
      expect(completed).toBe(false);

      // second check: task retrieval returns some error, try again
      $httpBackend.expectGET(checkUrl).respond(500, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(false);

      // third check: task is not present, should complete
      $httpBackend.expectGET(checkUrl).respond(404, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(true);
    });
開發者ID:jcwest,項目名稱:deck,代碼行數:27,代碼來源:task.write.service.spec.ts

示例2: it

    it('should propagate rejection from failed delete', () => {
      let failed = false;
      const executionId = 'abc';
      const deleteUrl = [ SETTINGS.gateUrl, 'pipelines', executionId ].join('/');
      const application: Application = { name: 'deck', executions: { refresh: () => $q.when(null) } } as any;

      $httpBackend.expectDELETE(deleteUrl).respond(500, []);

      executionService.deleteExecution(application, executionId).then(noop, () => failed = true);
      $httpBackend.flush();
      expect(failed).toBe(true);
    });
開發者ID:robfletcher,項目名稱:deck,代碼行數:12,代碼來源:execution.service.spec.ts


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