Skip to content

Commit

Permalink
temp: tests and lint now pass
Browse files Browse the repository at this point in the history
  • Loading branch information
telemachus committed Dec 6, 2024
1 parent f3c2f80 commit 2f05bc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion internal/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (app *appEnv) noOp() bool {
func alternativeNewAppEnv(cmd string) *appEnv {
return &appEnv{
cmd: cmd,
exitValue: exitSucess,
exitValue: exitSuccess,
}
}

Expand Down
20 changes: 9 additions & 11 deletions internal/cli/getrepos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ func makeRepos() []Repo {
}
}

func makeNewAppEnv(cfgFile string) *appEnv {
cfg := &cfg{
cmd: "test",
subCmd: "testing",
cfgFile: cfgFile,
defaultCfgFile: false,
func fakeNewAppEnv(cfgFile string) *appEnv {
return &appEnv{
cmd: "test",
subCmd: "testing",
cfgFile: cfgFile,
exitValue: exitSuccess,
}

return newAppEnv(cfg)
}

func TestGetReposSuccess(t *testing.T) {
expected := makeRepos()
app := makeNewAppEnv("testdata/backups.json")
app := fakeNewAppEnv("testdata/backups.json")
actual := app.getRepos()

if app.exitValue != exitSuccess {
Expand All @@ -40,7 +38,7 @@ func TestGetReposSuccess(t *testing.T) {
}

func TestGetReposFailure(t *testing.T) {
app := makeNewAppEnv("testdata/nope.json")
app := fakeNewAppEnv("testdata/nope.json")
app.getRepos()

if app.exitValue != exitFailure {
Expand All @@ -49,7 +47,7 @@ func TestGetReposFailure(t *testing.T) {
}

func TestRepoChecks(t *testing.T) {
app := makeNewAppEnv("testdata/repo-checks.json")
app := fakeNewAppEnv("testdata/repo-checks.json")
actual := app.getRepos()

if len(actual) != 0 {
Expand Down
5 changes: 2 additions & 3 deletions internal/cli/gitmirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ func parse(args []string) (*cfg, error) {
app.subCmd = op.Extra[0]
// TODO: Fix this
if app.cfgFile == "" {
app.defaultCfgFile = true
cfg.cfgFile = defaultCfgFile
app.cfgFile = defaultCfgFile
}

return cfg, nil
return nil, nil
}

// Quick and dirty, but why be fancy?
Expand Down

0 comments on commit 2f05bc9

Please sign in to comment.