Skip to content

Commit 82573a3

Browse files
committed
test: Improve coverage for Saxon Scales.
1 parent d5c4170 commit 82573a3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/scales/__tests__/saxon.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Saxon as SaxonScale } from '../../scales'
2+
3+
describe('SAXON', () => {
4+
describe('valid grade formats', () => {
5+
let consoleWarnSpy
6+
7+
beforeEach(() => {
8+
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation()
9+
})
10+
11+
afterEach(() => {
12+
consoleWarnSpy.mockRestore()
13+
})
14+
15+
test('should handle valid grade format "1"', () => {
16+
const score = SaxonScale.getScore('1')
17+
expect(console.warn).not.toHaveBeenCalled()
18+
expect(score).not.toEqual(-1)
19+
})
20+
})
21+
22+
describe('isType', () => {
23+
test('should return true for valid grade format "7a"', () => {
24+
const isValid = SaxonScale.isType('7a')
25+
expect(isValid).toBe(true)
26+
})
27+
28+
test('should return true for valid grade format "1"', () => {
29+
const isValid = SaxonScale.isType('1')
30+
expect(isValid).toBe(true)
31+
})
32+
33+
test('should return false for invalid grade format "V"', () => {
34+
const isValid = SaxonScale.isType('V')
35+
expect(isValid).toBe(false)
36+
})
37+
38+
test('should return false for invalid grade format "8d"', () => {
39+
const isValid = SaxonScale.isType('8d')
40+
expect(isValid).toBe(false)
41+
})
42+
})
43+
})

0 commit comments

Comments
 (0)