firebase / firebase/firebase-admin-go

Allow package consumers to simulate errors in test

Open
#416 11 comments 17 reactions 1 assignee Claimed by @lahirumaramba View on GitHub
api: auth
Dominant language
Go
Stars
1.3k
Forks
274
Avg merge
10h 39m
Merged PRs (30d)
2

Description

### [REQUIRED] Step 2: Describe your environment

* Library version: latest
* Firebase Product: auth (but applies to all packages)

### [REQUIRED] Step 3: Describe the problem
FirebaseError, along with it's relevant constructor, currently live inside package `internal`. `errorutils` gives a handy way to check if an error is a specific type of firebase error, but it's not possible to simulate these errors in unit tests in go, because consumers of the library don't have the ability to create error instances.

This means that usages of `errorutils` can't be unit tested directly - one would have to mock outbound http calls and hope to generate modern response bodies that Firebase creates, which is probably a good deal less desirable.

Do you have a recommended approach to testing simulated error conditions, today? Would it be possible to expand available error handling interfaces/APIs in a way that allows library consumers to simulate error conditions in test?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.