55 "strconv"
66 "testing"
77
8+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
9+
810 "github.com/google/go-cmp/cmp/cmpopts"
911 "github.com/stackitcloud/stackit-cli/internal/cmd/params"
1012 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
@@ -19,11 +21,14 @@ import (
1921type testCtxKey struct {}
2022
2123var (
22- testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
23- testClient = & alb.APIClient {}
24- testProjectId = uuid .NewString ()
25- testRegion = "eu01"
26- testLimit int64 = 10
24+ testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
25+ testClient = & alb.APIClient {}
26+ testProjectId = uuid .NewString ()
27+ )
28+
29+ const (
30+ testRegion = "eu01"
31+ testLimit int64 = 10
2732)
2833
2934func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
@@ -41,7 +46,7 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
4146func fixtureInputModel (mods ... func (model * inputModel )) * inputModel {
4247 model := & inputModel {
4348 GlobalFlagModel : & globalflags.GlobalFlagModel {ProjectId : testProjectId , Region : testRegion , Verbosity : globalflags .VerbosityDefault },
44- Limit : & testLimit ,
49+ Limit : utils . Ptr ( testLimit ) ,
4550 }
4651 for _ , mod := range mods {
4752 mod (model )
@@ -136,6 +141,7 @@ func TestBuildRequest(t *testing.T) {
136141func Test_outputResult (t * testing.T ) {
137142 type args struct {
138143 outputFormat string
144+ projectLabel string
139145 items []alb.LoadBalancer
140146 }
141147 tests := []struct {
@@ -164,7 +170,7 @@ func Test_outputResult(t *testing.T) {
164170 p .Cmd = NewCmd (& params.CmdParams {Printer : p })
165171 for _ , tt := range tests {
166172 t .Run (tt .name , func (t * testing.T ) {
167- if err := outputResult (p , tt .args .outputFormat , tt .args .items ); (err != nil ) != tt .wantErr {
173+ if err := outputResult (p , tt .args .outputFormat , tt .args .projectLabel , tt . args . items ); (err != nil ) != tt .wantErr {
168174 t .Errorf ("outputResult() error = %v, wantErr %v" , err , tt .wantErr )
169175 }
170176 })
0 commit comments