Handling Errors in Exit Type for Invalid Schema Test

How do I get the error out of an Exit type?

test('Invalid schema when default environment is set to an undefined environment', () => {
            const invalidConfig = {
                ...validConfig,
            }

            invalidConfig.environment.default = "production"

            ConfigV1.TaqConfigV1.of(invalidConfig).pipe(
                Effect.provideService(Services.TranslatorService, Services.Translator),
                Effect.runSyncExit,
                Exit.match({
                    onFailure(cause) {
                        expect(cause).toBeInstanceOf(TaqConfigV1ValidationError)
                    },
                    onSuccess (value) {
                        expect(value).toBe(null)
                    }
                })
            )
        })
    })
Was this page helpful?