github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/cli/args/move_postfix_test.go (about)

     1  package args_test
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  
     7  	tauCLI "github.com/taubyte/tau-cli/cli"
     8  	argsLib "github.com/taubyte/tau-cli/cli/args"
     9  )
    10  
    11  func TestPostfix(t *testing.T) {
    12  	app, err := tauCLI.New()
    13  	if err != nil {
    14  		t.Error(err)
    15  		return
    16  	}
    17  
    18  	parsedFlags := argsLib.ParseFlags(app.Flags)
    19  	testArgs := []string{"tau", "login", "--env", "someName", "--color", "never"}
    20  
    21  	gotArgs := argsLib.MovePostfixOptions(testArgs, parsedFlags)
    22  	expectedArgs := []string{"tau", "--env", "--color", "never", "login", "someName"}
    23  	if !reflect.DeepEqual(gotArgs, expectedArgs) {
    24  		t.Errorf("\nExpected: %v\nGot     : %v", expectedArgs, gotArgs)
    25  	}
    26  }