OpenBeta / sandbag

JS utilities for working with climbing grades
MIT License
24 stars 17 forks source link

YDS slash grades broken #142

Closed musoke closed 1 year ago

musoke commented 1 year ago

I expect that 5.10a/b should convert to a score range that is a subset of those for 5.10a and 5.10b. It is actually the same range as for 5.10a.

This test should pass:

    test('slash grades should be subset', () => {
        const slashScore = YosemiteDecimal.getScore('5.10a/b')
        console.log("slashScore = ", slashScore)
        const lowScore = YosemiteDecimal.getScore('5.10a')
        console.log("lowScore = ", lowScore)
        const highScore = YosemiteDecimal.getScore('5.10b')
        console.log("highScore = ", highScore)

        expect(slashScore[0]).toBeGreaterThan(lowScore[0])
        expect(slashScore[1]).toBeGreaterThan(lowScore[1])
        expect(slashScore[0]).toBeLessThan(highScore[0])
        expect(slashScore[1]).toBeLessThan(highScore[1])
    })

actual output:

  ● Console

    console.log
      slashScore =  [ 57, 61 ]

      at Object.<anonymous> (src/__tests__/scales/yds.ts:119:17)

    console.log
      lowScore =  [ 57, 61 ]

      at Object.<anonymous> (src/__tests__/scales/yds.ts:121:17)

    console.log
      highScore =  [ 62, 63 ]

      at Object.<anonymous> (src/__tests__/scales/yds.ts:123:17)

  ● YosemiteDecimal › slash grades › slash grades should be subset

    expect(received).toBeGreaterThan(expected)

    Expected: > 57
    Received:   57

      123 |         console.log("highScore = ", highScore)
      124 |
    > 125 |         expect(slashScore[0]).toBeGreaterThan(lowScore[0])
          |                               ^
      126 |         expect(slashScore[1]).toBeGreaterThan(lowScore[1])
      127 |         expect(slashScore[0]).toBeLessThan(highScore[0])
      128 |         expect(slashScore[1]).toBeLessThan(highScore[1])

      at Object.<anonymous> (src/__tests__/scales/yds.ts:125:31)

 PASS  src/scales/__tests__/wi.ts

Test Suites: 1 failed, 6 passed, 7 total
Tests:       1 failed, 63 passed, 64 total
Snapshots:   0 total
Time:        3.18 s
Ran all test suites.
error Command failed with exit code 1.