I am trying to test this class method:
get () {
try {
return getSomething()
} catch (e) {
return getSomethingAnotherWay()
}
}
with:
test('the get method retrieves value', () => {
const value = MyClass.get()
expect(value).toBe('value')
})
My test coverage shows I have tested the try part of the method but not the catch part.
How can I cover the catch part?
Aucun commentaire:
Enregistrer un commentaire