func (s *workItemLinkTypeSuite) TestListWorkItemLinkTypeOK() {
	bugBlockerPayload := s.createDemoLinkType(s.linkTypeName)
	_, bugBlockerType := test.CreateWorkItemLinkTypeCreated(s.T(), s.svc.Context, s.svc, s.linkTypeCtrl, bugBlockerPayload.Data.Relationships.Space.Data.ID.String(), bugBlockerPayload)
	require.NotNil(s.T(), bugBlockerType)

	workItemTypePayload := CreateWorkItemType(uuid.NewV4(), *s.spaceID)
	_, workItemType := test.CreateWorkitemtypeCreated(s.T(), s.svc.Context, s.svc, s.typeCtrl, bugBlockerPayload.Data.Relationships.Space.Data.ID.String(), &workItemTypePayload)
	require.NotNil(s.T(), workItemType)

	relatedPayload := CreateWorkItemLinkType(s.linkName, *workItemType.Data.ID, *workItemType.Data.ID, bugBlockerType.Data.Relationships.LinkCategory.Data.ID, *bugBlockerType.Data.Relationships.Space.Data.ID)
	_, relatedType := test.CreateWorkItemLinkTypeCreated(s.T(), s.svc.Context, s.svc, s.linkTypeCtrl, relatedPayload.Data.Relationships.Space.Data.ID.String(), relatedPayload)
	require.NotNil(s.T(), relatedType)

	// Fetch a single work item link type
	_, linkTypeCollection := test.ListWorkItemLinkTypeOK(s.T(), nil, nil, s.linkTypeCtrl, relatedPayload.Data.Relationships.Space.Data.ID.String(), nil, nil)
	require.NotNil(s.T(), linkTypeCollection)
	require.Nil(s.T(), linkTypeCollection.Validate())
	// Check the number of found work item link types
	require.NotNil(s.T(), linkTypeCollection.Data)
	require.Condition(s.T(), func() bool {
		return (len(linkTypeCollection.Data) >= 2)
	}, "At least two work item link types must exist (bug-blocker and related), but only %d exist.", len(linkTypeCollection.Data))
	// Search for the work item types that must exist at minimum
	toBeFound := 2
	for i := 0; i < len(linkTypeCollection.Data) && toBeFound > 0; i++ {
		if *linkTypeCollection.Data[i].Attributes.Name == s.linkTypeName || *linkTypeCollection.Data[i].Attributes.Name == s.linkName {
			s.T().Log("Found work item link type in collection: ", *linkTypeCollection.Data[i].Attributes.Name)
			toBeFound--
		}
	}
	require.Exactly(s.T(), 0, toBeFound, "Not all required work item link types (bug-blocker and related) where found.")

	// Check that the link categories are included in the response in the "included" array
	require.Len(s.T(), linkTypeCollection.Included, 2, "The work item link type should include it's work item link category and space.")
	categoryData, ok := linkTypeCollection.Included[0].(*app.WorkItemLinkCategoryData)
	require.True(s.T(), ok)
	require.Equal(s.T(), s.categoryName, *categoryData.Attributes.Name, "The work item link type's category should have the name 'test-user'.")

	// Check that the link spaces are included in the response in the "included" array
	spaceData, ok := linkTypeCollection.Included[1].(*app.Space)
	require.True(s.T(), ok)
	require.Equal(s.T(), s.spaceName, *spaceData.Attributes.Name, "The work item link type's category should have the name 'test-space'.")

}
// TestListWorkItemLinkTypeOK tests if we can find the work item link types
// s.linkTypeName and s.linkName in the list of work item link types
TestListWorkItemLinkTypeOK tests if we can find the work item link types
s.linkTypeName and s.linkName in the list of work item link types
// TestListWorkItemLinkTypeOK tests if we can find the work item link types // s . linkTypeName and s . linkName in the list of work item link types
func (s *workItemLinkTypeSuite) TestListWorkItemLinkTypeOK() {
	bugBlockerPayload := s.createDemoLinkType(s.linkTypeName)
	_, bugBlockerType := test.CreateWorkItemLinkTypeCreated(s.T(), s.svc.Context, s.svc, s.linkTypeCtrl, bugBlockerPayload.Data.Relationships.Space.Data.ID.String(), bugBlockerPayload)
	require.NotNil(s.T(), bugBlockerType)
	workItemTypePayload := CreateWorkItemType(uuid.NewV4(), *s.spaceID)
	_, workItemType := test.CreateWorkitemtypeCreated(s.T(), s.svc.Context, s.svc, s.typeCtrl, bugBlockerPayload.Data.Relationships.Space.Data.ID.String(), &workItemTypePayload)
	require.NotNil(s.T(), workItemType)
	relatedPayload := CreateWorkItemLinkType(s.linkName, *workItemType.Data.ID, *workItemType.Data.ID, bugBlockerType.Data.Relationships.LinkCategory.Data.ID, *bugBlockerType.Data.Relationships.Space.Data.ID)
	_, relatedType := test.CreateWorkItemLinkTypeCreated(s.T(), s.svc.Context, s.svc, s.linkTypeCtrl, relatedPayload.Data.Relationships.Space.Data.ID.String(), relatedPayload)
	require.NotNil(s.T(), relatedType)
	_, linkTypeCollection := test.ListWorkItemLinkTypeOK(s.T(), nil, nil, s.linkTypeCtrl, relatedPayload.Data.Relationships.Space.Data.ID.String(), nil, nil)
	require.NotNil(s.T(), linkTypeCollection)
	require.Nil(s.T(), linkTypeCollection.Validate())
	require.NotNil(s.T(), linkTypeCollection.Data)
	require.Condition(s.T(), func() bool {
		return (len(linkTypeCollection.Data) >= 2)
	}, "At least two work item link types must exist (bug-blocker and related), but only %d exist.", len(linkTypeCollection.Data))
	toBeFound := 2
	for i := 0; i < len(linkTypeCollection.Data) && toBeFound > 0; i++ {
		if *linkTypeCollection.Data[i].Attributes.Name == s.linkTypeName || *linkTypeCollection.Data[i].Attributes.Name == s.linkName {
			s.T().Log("Found work item link type in collection: ", *linkTypeCollection.Data[i].Attributes.Name)
			toBeFound--
		}
	}
	require.Exactly(s.T(), 0, toBeFound, "Not all required work item link types (bug-blocker and related) where found.")
	require.Len(s.T(), linkTypeCollection.Included, 2, "The work item link type should include it's work item link category and space.")
	categoryData, ok := linkTypeCollection.Included[0].(*app.WorkItemLinkCategoryData)
	require.True(s.T(), ok)
	require.Equal(s.T(), s.categoryName, *categoryData.Attributes.Name, "The work item link type's category should have the name 'test-user'.")
	spaceData, ok := linkTypeCollection.Included[1].(*app.Space)
	require.True(s.T(), ok)
	require.Equal(s.T(), s.spaceName, *spaceData.Attributes.Name, "The work item link type's category should have the name 'test-space'.")
}
func ( s * workItemLinkTypeSuite ) TestListWorkItemLinkTypeOK ( ) { bugBlockerPayload := s . createDemoLinkType ( s . linkTypeName ) _ , bugBlockerType := test . CreateWorkItemLinkTypeCreated ( s . T ( ) , s . svc . Context , s . svc , s . linkTypeCtrl , bugBlockerPayload . Data . Relationships . Space . Data . ID . String ( ) , bugBlockerPayload ) require . NotNil ( s . T ( ) , bugBlockerType ) workItemTypePayload := CreateWorkItemType ( uuid . NewV4 ( ) , * s . spaceID ) _ , workItemType := test . CreateWorkitemtypeCreated ( s . T ( ) , s . svc . Context , s . svc , s . typeCtrl , bugBlockerPayload . Data . Relationships . Space . Data . ID . String ( ) , & workItemTypePayload ) require . NotNil ( s . T ( ) , workItemType ) relatedPayload := CreateWorkItemLinkType ( s . linkName , * workItemType . Data . ID , * workItemType . Data . ID , bugBlockerType . Data . Relationships . LinkCategory . Data . ID , * bugBlockerType . Data . Relationships . Space . Data . ID ) _ , relatedType := test . CreateWorkItemLinkTypeCreated ( s . T ( ) , s . svc . Context , s . svc , s . linkTypeCtrl , relatedPayload . Data . Relationships . Space . Data . ID . String ( ) , relatedPayload ) require . NotNil ( s . T ( ) , relatedType ) _ , linkTypeCollection := test . ListWorkItemLinkTypeOK ( s . T ( ) , nil , nil , s . linkTypeCtrl , relatedPayload . Data . Relationships . Space . Data . ID . String ( ) , nil , nil ) require . NotNil ( s . T ( ) , linkTypeCollection ) require . Nil ( s . T ( ) , linkTypeCollection . Validate ( ) ) require . NotNil ( s . T ( ) , linkTypeCollection . Data ) require . Condition ( s . T ( ) , func ( ) bool { return ( len ( linkTypeCollection . Data ) >= 2 ) } , " " , len ( linkTypeCollection . Data ) ) toBeFound := 2 for i := 0 ; i < len ( linkTypeCollection . Data ) && toBeFound > 0 ; i ++ { if * linkTypeCollection . Data [ i ] . Attributes . Name == s . linkTypeName || * linkTypeCollection . Data [ i ] . Attributes . Name == s . linkName { s . T ( ) . Log ( " " , * linkTypeCollection . Data [ i ] . Attributes . Name ) toBeFound -- } } require . Exactly ( s . T ( ) , 0 , toBeFound , " " ) require . Len ( s . T ( ) , linkTypeCollection . Included , 2 , " " ) categoryData , ok := linkTypeCollection . Included [ 0 ] . ( * app . WorkItemLinkCategoryData ) require . True ( s . T ( ) , ok ) require . Equal ( s . T ( ) , s . categoryName , * categoryData . Attributes . Name , " " ) spaceData , ok := linkTypeCollection . Included [ 1 ] . ( * app . Space ) require . True ( s . T ( ) , ok ) require . Equal ( s . T ( ) , s . spaceName , * spaceData . Attributes . Name , " " ) }
TestListWorkItemLinkTypeOK tests if we can find the work item link types
s.linkTypeName and s.linkName in the list of work item link types
TestListWorkItemLinkTypeOK tests if we can find the work item link types s . linkTypeName and s . linkName in the list of work item link types
// Fetch a single work item link type // Check the number of found work item link types // Search for the work item types that must exist at minimum // Check that the link categories are included in the response in the "included" array // Check that the link spaces are included in the response in the "included" array