function performDeployTask()

in Tasks/codepush-release/test.js [53:72]


  function performDeployTask(shouldFail) {
    var performDeployTaskSpy = sinon.spy(CodePush, "performDeployTask");
    spies.push(CodePush.performDeployTask)
    
    var tlSetResultSpy = sinon.stub(tl, "setResult").callsFake(() => {});
    spies.push(tl.setResult);
    
    try {
      CodePush.performDeployTask(ACCESS_KEY, APP_NAME, PACKAGE_PATH, APP_STORE_VERSION, DEPLOYMENT_NAME, DESCRIPTION, ROLLOUT, IS_MANDATORY, IS_DISABLED);
    } catch (e) {
      assert(shouldFail, "Threw an unexpected error");
    }
    
    if (shouldFail) {
      assert(performDeployTaskSpy.threw(), "Did not throw an error");
      assert.equal(tlSetResultSpy.called && tlSetResultSpy.firstCall.args[0], 1, "Did not set task result to 1 on failure");
    } else {
      assert(!tlSetResultSpy.called, "Should not set task result if task succeeds");
    }
  }