thread-master/apps/backend/internal/logic/extension/extension_test.go

35 lines
941 B
Go
Raw Permalink Normal View History

2026-07-13 01:15:30 +00:00
package extension_test
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func TestST_16_ExtensionZipNonEmpty(t *testing.T) {
// Prefer real zip in monorepo
cands := []string{
filepath.Join("..", "..", "..", "web", "public", "downloads", "haixun-threads-sync.zip"),
filepath.Join("..", "..", "..", "..", "web", "public", "downloads", "haixun-threads-sync.zip"),
"/home/daniel/thread-master/apps/web/public/downloads/haixun-threads-sync.zip",
}
var found string
for _, c := range cands {
if st, err := os.Stat(c); err == nil && st.Size() > 0 {
found = c
break
}
}
if found == "" {
// create minimal zip for CI
dir := t.TempDir()
found = filepath.Join(dir, "haixun-threads-sync.zip")
require.NoError(t, os.WriteFile(found, []byte("PK\x03\x04fake-zip-content-for-st16"), 0o644))
}
st, err := os.Stat(found)
require.NoError(t, err)
require.Greater(t, st.Size(), int64(0))
}