-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Break the issue parsing into a function and test sending various
data to it
- Loading branch information
1 parent
86e133b
commit 6eadf59
Showing
2 changed files
with
55 additions
and
2 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
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,40 @@ | ||
import { parseIssueNumber } from '../src/analyze'; | ||
|
||
describe('parseIssueNumber', () => { | ||
it('should return an integer when an integer is provided', () => { | ||
expect(parseIssueNumber(123)).toEqual(123); | ||
}); | ||
|
||
it('should return an integer when a numeric string is provided', () => { | ||
expect(parseIssueNumber('123')).toEqual(123); | ||
}); | ||
|
||
it('should return undefined when a non-numeric string is provided', () => { | ||
expect(parseIssueNumber('abc')).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when an empty string is provided', () => { | ||
expect(parseIssueNumber('')).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when a string with spaces is provided', () => { | ||
expect(parseIssueNumber(' ')).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when a null value is provided', () => { | ||
expect(parseIssueNumber(null)).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when an undefined value is provided', () => { | ||
expect(parseIssueNumber(undefined)).toBeUndefined(); | ||
}); | ||
|
||
it('should return undefined when a boolean value is provided', () => { | ||
expect(parseIssueNumber(true)).toBeUndefined(); | ||
expect(parseIssueNumber(false)).toBeUndefined(); | ||
}); | ||
|
||
it('should return the integer part when a string with a number and letters is provided', () => { | ||
expect(parseIssueNumber('123abc')).toEqual(123); | ||
}); | ||
}); |