Skip to content

Allow package consumers to simulate errors in test #416

@bpicolo

Description

@bpicolo

[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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions