Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Conversions/RailwayTimeConversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const RailwayTimeConversion = (timeString) => {
// firstly, check that input is a string or not.
if (typeof timeString !== 'string') {
return new TypeError('Argument is not a string.')
throw new TypeError('Argument is not a string.')
}
// split the string by ':' character.
const [hour, minute, secondWithShift] = timeString.split(':')
Expand Down
4 changes: 4 additions & 0 deletions Conversions/test/RailwayTimeConversion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ test('The RailwayTimeConversion of 11:20:00PM is 23:20:00', () => {
const res = RailwayTimeConversion('11:20:00PM')
expect(res).toEqual('23:20:00')
})

test('The RailwayTimeConversion throws when input is not a string', () => {
expect(() => RailwayTimeConversion(1120)).toThrowError()
})