Example #1
0
  it('treats null as zeroes', () => {
    const withNulls = {
      optimistic: 2,
      realistic: null,
      pessimistic: null
    }

    const withZeroes = {
      optimistic: 2,
      realistic: 0,
      pessimistic: 0
    }

    expect(pert(withNulls)).toEqual(pert(withZeroes))
  })
Example #2
0
    return function(e) {
      const newEstimate = this.extractEstimate(e, type)
      const estimateData = Object.assign({}, this.state, {[type]: newEstimate})

      this.setState({
        [type]: newEstimate,
        estimate: pert(estimateData)
      })
    }.bind(this)
Example #3
0
  it('calculates estimate', () => {
    const estimates = {
      optimistic: 1,
      realistic: 2,
      pessimistic: 3
    }

    expect(pert(estimates)).toEqual(2.75)
  })
Example #4
0
  it('returns null if all estimates are missing', () => {
    const estimates = {
      optimistic: null,
      realistic: null,
      pessimistic: null
    }

    expect(pert(estimates)).toEqual(null)
  })