-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Improve coverage for Saxon Scales.
- Loading branch information
1 parent
d5c4170
commit d0b6d64
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": false, | ||
"source.fixAll.eslint": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Saxon as SaxonScale } from '../../scales' | ||
|
||
describe('SAXON', () => { | ||
describe('valid grade formats', () => { | ||
let consoleWarnSpy | ||
|
||
beforeEach(() => { | ||
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation() | ||
}) | ||
|
||
afterEach(() => { | ||
consoleWarnSpy.mockRestore() | ||
}) | ||
|
||
test('should handle valid grade format "1"', () => { | ||
const score = SaxonScale.getScore('1') | ||
expect(console.warn).not.toHaveBeenCalled() | ||
expect(score).not.toEqual(-1) | ||
}) | ||
}) | ||
|
||
describe('isType', () => { | ||
test('should return true for valid grade format "7a"', () => { | ||
const isValid = SaxonScale.isType('7a') | ||
expect(isValid).toBe(true) | ||
}) | ||
|
||
test('should return true for valid grade format "1"', () => { | ||
const isValid = SaxonScale.isType('1') | ||
expect(isValid).toBe(true) | ||
}) | ||
|
||
test('should return false for invalid grade format "V"', () => { | ||
const isValid = SaxonScale.isType('V') | ||
expect(isValid).toBe(false) | ||
}) | ||
|
||
test('should return false for invalid grade format "8d"', () => { | ||
const isValid = SaxonScale.isType('8d') | ||
expect(isValid).toBe(false) | ||
}) | ||
}) | ||
}) |