Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
update tests for version sc
Browse files Browse the repository at this point in the history
  • Loading branch information
everettraven committed Feb 6, 2022
1 parent 48f87c4 commit dc2106d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions subcommands/version_sc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package subcommands

import (
"reflect"
"testing"

"github.com/everettraven/packageless/utils"
Expand Down Expand Up @@ -28,3 +29,30 @@ func TestVersionInit(t *testing.T) {
t.Fatalf("This method should do nothing except return nil | Received: %s", err)
}
}

func TestVersionRun(t *testing.T) {
mockUtility := utils.NewMockUtility()

vc := NewVersionCommand(mockUtility)

err := vc.Init([]string{})

if err != nil {
t.Fatalf("This method should do nothing except return nil | Received: %s", err)
}

err = vc.Run()

if err != nil {
t.Fatalf("This subcommand should not return an error | Received: %s", err)
}

callStack := []string{
"RenderInfoMarkdown",
}

//If the call stack doesn't match the test fails
if !reflect.DeepEqual(callStack, mockUtility.Calls) {
t.Fatalf("Call Stack does not match the expected call stack. Call Stack: %v | Expected Call Stack: %v", mockUtility.Calls, callStack)
}
}

0 comments on commit dc2106d

Please sign in to comment.