diff --git a/src/scales/__tests__/saxon.ts b/src/scales/__tests__/saxon.ts index a2baeef..944ea95 100644 --- a/src/scales/__tests__/saxon.ts +++ b/src/scales/__tests__/saxon.ts @@ -40,4 +40,11 @@ describe('SAXON', () => { expect(isValid).toBe(false) }) }) + + describe('getScore', () => { + test('should handle grade format with slash "7a/7b"', () => { + const score = SaxonScale.getScore('7a/7b') + expect(score).not.toEqual(-1) + }) + }) }) diff --git a/src/scales/saxon.ts b/src/scales/saxon.ts index 400811d..f430abc 100644 --- a/src/scales/saxon.ts +++ b/src/scales/saxon.ts @@ -3,7 +3,7 @@ import routes from '../data/routes.json' import { Route } from '.' import { GradeBandTypes, routeScoreToBand } from '../GradeBands' -const saxonGradeRegex = /^((([7-9]|1[0-3])([a-c]))|([1-6]))$/i +const saxonGradeRegex = /^((([7-9]|1[0-3])([a-c]))|([1-6])|([7-9]|1[0-3])(([a-c])\/([7-9]|1[0-3])([a-c])))$/i // Saxon grading system, predominant in Central Europe (esp. Germany, Austria, Switzerland) // Supports 1 -> 13c, slash grades i.e. 7a/7b // Uses Arabic numerals with letters from a-c, e.g. "7a" , "7b", or "7c" (hardest)