OpenBeta / sandbag

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

test: Improve coverage for Saxon Scales. #154

Open marinojoey opened 1 year ago

marinojoey commented 1 year ago

I was trying to make a test for '7a/7b' but it was erroring that it was not an expected Saxon Grade. I believe this is a problem with the regex in src/scales/saxon.ts. From some simple testing, this regex matches '7a/7b': 1/^((([7-9]|1[0-3])([a-c]))|([1-6])|([7-9]|1[0-3])(([a-c])\/([7-9]|1[0-3])([a-c])))$/i.

For now I pushed up tests that pass inside one commit. For the sake of performance, they were specifically written to improve coverage and nothing else (i.e. __tests__/saxon.ts is not a comprehensive test suite for the Saxon system).

The other commit includes a potential solution to the grade regex.

github-actions[bot] commented 1 year ago

Coverage report

Statements coverage not met for global: expected <=999999 not covered statements, but got 549
St.:grey_question:
Category Percentage Covered / Total
🟒 Statements
86.87% (+0.47% πŸ”Ό)
549/632
🟑 Branches
65.9% (+0.58% πŸ”Ό)
114/173
🟒 Functions
80.15% (+0.74% πŸ”Ό)
109/136
🟒 Lines
86.08% (+0.51% πŸ”Ό)
507/589

Test suite run success

258 tests passing in 17 suites.

Report generated by πŸ§ͺjest coverage report action from 1b8f6f3ab8024bbd61552c90bf10046f96db590e

vnugent commented 1 year ago

Could you move the existing tests to the location of your current tests and add any new cases to that?

@marinojoey can you finish this PR?