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


TypeScript IHttpBackendService.expectPUT方法代碼示例

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


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

示例1: it

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

      $httpBackend.expectPUT(cancelUrl).respond(500, []);

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

示例2: it

    it("should PUT data for correct URL", () => {
        $httpBackend.expectPUT("https://myurl.com/api/myput").respond({data: "test"});

        service.getData({
            webservice: "api/myput",
            type: "PUT"
        }).then(data => {
            expect(data).toEqual({data: "test"});
        });

        $httpBackend.flush();
    });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:12,代碼來源:data.service.spec.ts

示例3: it

    it('should wait until pipeline is RUNNING, then resolve', () => {
      let completed = false;
      const executionId = 'abc';
      const pauseUrl = [SETTINGS.gateUrl, 'pipelines', executionId, 'resume'].join('/');
      const singleExecutionUrl = [SETTINGS.gateUrl, 'pipelines', executionId].join('/');
      const application: Application = { name: 'deck', executions: { refresh: () => $q.when(null) } } as any;

      $httpBackend.expectPUT(pauseUrl).respond(200, []);
      $httpBackend.expectGET(singleExecutionUrl).respond(200, { id: executionId, status: 'PAUSED' });

      executionService.resumeExecution(application, executionId).then(() => (completed = true));
      $httpBackend.flush();
      expect(completed).toBe(false);

      $httpBackend.expectGET(singleExecutionUrl).respond(200, { id: executionId, status: 'RUNNING' });
      timeout.flush();
      $httpBackend.flush();

      expect(completed).toBe(true);
    });
開發者ID:mizzy,項目名稱:deck,代碼行數:20,代碼來源:execution.service.spec.ts

示例4: it

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

      $httpBackend.expectPUT(cancelUrl).respond(200, []);
      $httpBackend.expectGET(checkUrl).respond(200, { id: taskId });

      TaskWriter.cancelTask(taskId).then(() => (completed = true));
      $httpBackend.flush();
      expect(completed).toBe(false);

      $httpBackend.expectGET(checkUrl).respond(200, { id: taskId });
      timeout.flush();
      $httpBackend.flush();

      $httpBackend.expectGET(checkUrl).respond(200, { status: 'CANCELED' });
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(true);
    });
開發者ID:emjburns,項目名稱:deck,代碼行數:22,代碼來源:task.write.service.spec.ts


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