mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 05:25:15 +01:00 
			
		
		
		
	Replace all contexts in tests with go1.24 t.Context() --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
		
			
				
	
	
		
			29 lines
		
	
	
		
			803 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			803 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2024 The Gitea Authors. All rights reserved.
 | 
						|
// SPDX-License-Identifier: MIT
 | 
						|
 | 
						|
package actions
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	actions_model "code.gitea.io/gitea/models/actions"
 | 
						|
	"code.gitea.io/gitea/models/unittest"
 | 
						|
 | 
						|
	"github.com/stretchr/testify/assert"
 | 
						|
)
 | 
						|
 | 
						|
func TestFindTaskNeeds(t *testing.T) {
 | 
						|
	assert.NoError(t, unittest.PrepareTestDatabase())
 | 
						|
 | 
						|
	task := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionTask{ID: 51})
 | 
						|
	job := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunJob{ID: task.JobID})
 | 
						|
 | 
						|
	ret, err := FindTaskNeeds(t.Context(), job)
 | 
						|
	assert.NoError(t, err)
 | 
						|
	assert.Len(t, ret, 1)
 | 
						|
	assert.Contains(t, ret, "job1")
 | 
						|
	assert.Len(t, ret["job1"].Outputs, 2)
 | 
						|
	assert.Equal(t, "abc", ret["job1"].Outputs["output_a"])
 | 
						|
	assert.Equal(t, "bbb", ret["job1"].Outputs["output_b"])
 | 
						|
}
 |