Sha256: 21d2eea4d4a0977bac9a8127abb94b6a0ba792187c8794b3bb81e864a83fd199
Contents?: true
Size: 673 Bytes
Versions: 26
Compression:
Stored size: 673 Bytes
Contents
import { tryCatch } from './tryCatch' test('returns the function payload', () => { const result = tryCatch(() => 'hello') expect(result).toEqual('hello') }) test('silences exceptions by default', () => { const result = tryCatch(() => { throw new Error('Exception') }) expect(result).toBeUndefined() }) test('executes a custom callback function when an exception occurs', async () => { await new Promise<void>((resolve) => { tryCatch( () => { throw new Error('Exception') }, (error) => { expect(error).toBeInstanceOf(Error) expect(error.message).toEqual('Exception') resolve() }, ) }) })
Version data entries
26 entries across 26 versions & 1 rubygems