-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests and clean up folder structure
- Loading branch information
1 parent
83df106
commit 9c56c21
Showing
3 changed files
with
29 additions
and
1 deletion.
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
File renamed without changes.
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,28 @@ | ||
import { it, describe, expect } from "vitest"; | ||
import { parseNumericString } from "./string"; | ||
|
||
describe('parseNumericString', () => { | ||
it('should return an integer', () => { | ||
expect(parseNumericString('123')).toBe(123) | ||
}) | ||
|
||
it('should return an integer for a decimal', () => { | ||
expect(parseNumericString('123.123')).toBe(123) | ||
Check failure on line 10 in src/utils/string.test.ts GitHub Actions / coveragesrc/utils/string.test.ts > parseNumericString > should return an integer for a decimal
|
||
}) | ||
|
||
it('should return null for a string', () => { | ||
expect(parseNumericString('abc')).toBe(null) | ||
}) | ||
|
||
it('should return null for an empty string', () => { | ||
expect(parseNumericString('')).toBe(null) | ||
}) | ||
|
||
it('should return null for a negative number', () => { | ||
expect(parseNumericString('-123')).toBe(null) | ||
Check failure on line 22 in src/utils/string.test.ts GitHub Actions / coveragesrc/utils/string.test.ts > parseNumericString > should return null for a negative number
|
||
}) | ||
|
||
it('should return null for a negative number', () => { | ||
expect(parseNumericString('1a23')).toBe(null) | ||
}) | ||
}) |