Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
refactor: make function unit testable
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Feb 11, 2020
1 parent 6cd1c56 commit 151b0c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions firebase/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

const (
firebaseProjectConfig = "./.firebaserc"
defaultProject = "default"
firebaseProjectConfigFile = "./.firebaserc"
defaultProject = "default"
)

type FirebaseProjectConfigs struct {
Expand All @@ -28,8 +28,8 @@ type Firebase struct {
}

// setProjectID use the project alias to get the firebase project id
func (f *Firebase) setProjectID(projectAlias string) error {
configFileContent, err := s.File(firebaseProjectConfig).Bytes()
func (f *Firebase) setProjectID(projectAlias string, firebaseProjectConfigFile string) error {
configFileContent, err := s.File(firebaseProjectConfigFile).Bytes()
if err != nil {
return fmt.Errorf("An error occurred while reading config file: %w", err)
}
Expand All @@ -48,7 +48,7 @@ func (f *Firebase) initializeFirebaseApp(ctx context.Context, projectAlias strin
if projectAlias == "" {
projectAlias = defaultProject
}
err := f.setProjectID(projectAlias)
err := f.setProjectID(projectAlias, firebaseProjectConfigFile)
if err != nil {
return fmt.Errorf("An error occurred while reading config file: %w", err)
}
Expand Down

0 comments on commit 151b0c9

Please sign in to comment.