test(actions): drop duplicate cases and share the checks server

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 20:48:00 +02:00
1 parent 71d84b070b
commit 4a85bb3d40
5 files changed
+13 -29

No files matched your search

+2 -6
View File
@@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"gitea.dev/tea/internal/clierr"
@@ -97,7 +98,7 @@ func TestRunDownloadExtractsArtifactsByName(t *testing.T) {
return
}
require.NoError(t, err)
require.Equal(t, filepathReplace(tc.out, dir), diagnostics.String())
require.Equal(t, strings.ReplaceAll(tc.out, "{dir}", dir), diagnostics.String())
for name, content := range tc.files {
data, err := os.ReadFile(filepath.Join(dir, name))
require.NoError(t, err, name)
@@ -153,11 +154,6 @@ func TestExtractZipKeepsPermissionBits(t *testing.T) {
}
}
// filepathReplace puts dir in place of {dir} in text.
func filepathReplace(text, dir string) string {
return string(bytes.ReplaceAll([]byte(text), []byte("{dir}"), []byte(dir)))
}
func TestArtifactListShowsSizesAndExpiry(t *testing.T) {
server, _ := actionsAPI(t, map[string]string{
"GET actions/runs/29/artifacts": `{"total_count":2,"artifacts":[{"id":1,"name":"build","size_in_bytes":3145728,"expires_at":"2028-03-01T12:00:00Z"},{"id":3,"name":"old","size_in_bytes":13,"expired":true,"expires_at":"2027-12-01T12:00:00Z"}]}`,