test: skip networked tests if no connection (#661)

* test: skip networked tests if no connection

* fix: handle unexpected http responses

* fix: return if a valid URL is generated

* test: delete networked test
This commit is contained in:
bashbunni 2024-12-18 11:10:03 -08:00 committed by GitHub
commit 7b3bfac306
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,33 +1,9 @@
package main
import (
"bytes"
"testing"
)
func TestGlowSources(t *testing.T) {
tt := []string{
".",
"README.md",
"github.com/charmbracelet/glow",
"github://charmbracelet/glow",
"https://github.com/charmbracelet/glow",
}
for _, v := range tt {
t.Run(v, func(t *testing.T) {
buf := &bytes.Buffer{}
err := executeArg(rootCmd, v, buf)
if err != nil {
t.Errorf("Error during execution (args: %s): %v", v, err)
}
if buf.Len() == 0 {
t.Errorf("Output buffer should not be empty (args: %s)", v)
}
})
}
}
func TestGlowFlags(t *testing.T) {
tt := []struct {
args []string