@@ -4,10 +4,12 @@ package commands
44
55import (
66 "testing"
7+ "time"
78
89 asserts "github.com/stretchr/testify/assert"
910
1011 errorConstants "github.com/checkmarx/ast-cli/internal/constants/errors"
12+ "github.com/checkmarx/ast-cli/internal/wrappers"
1113 "github.com/checkmarx/ast-cli/internal/wrappers/mock"
1214 "github.com/checkmarx/ast-cli/internal/wrappers/utils"
1315
@@ -269,3 +271,30 @@ func TestSupportEmptyTags_whenOnlyKeysFlagHasEmptyValue_shouldNotChangeParams(t
269271 assert .Equal (t , params ["tags-values" ], "value1" )
270272 assert .Equal (t , len (params ), 4 )
271273}
274+
275+ func TestToProjectView (t * testing.T ) {
276+ // Arrange: Create a sample ProjectResponseModel
277+ input := wrappers.ProjectResponseModel {
278+ ID : "123" ,
279+ Name : "Test Project" ,
280+ CreatedAt : time .Now (),
281+ UpdatedAt : time .Now (),
282+ MainBranch : "main" ,
283+ Tags : map [string ]string {"key1" : "value1" },
284+ Groups : []string {"group1" , "group2" },
285+ ApplicationIds : []string {"app1" , "app2" },
286+ }
287+
288+ // Act: Call the toProjectView function
289+ result := toProjectView (input )
290+
291+ // Assert: Verify the fields are correctly mapped
292+ assert .Equal (t , result .ID , input .ID )
293+ assert .Equal (t , result .Name , input .Name )
294+ assert .Equal (t , result .CreatedAt , input .CreatedAt )
295+ assert .Equal (t , result .UpdatedAt , input .UpdatedAt )
296+ assert .Equal (t , result .MainBranch , input .MainBranch )
297+ assert .DeepEqual (t , result .Tags , input .Tags )
298+ assert .DeepEqual (t , result .Groups , input .Groups )
299+ assert .DeepEqual (t , result .ApplicationIds , input .ApplicationIds )
300+ }
0 commit comments