feat(blogo,gitea): minimal testing for the gitea package

This commit is contained in:
Guz
2025-01-08 11:16:23 -03:00
parent 57b740a490
commit e1c607c909

32
blogo/gitea/gitea_test.go Normal file
View File

@@ -0,0 +1,32 @@
package gitea_test
import (
"io"
"testing"
"forge.capytal.company/loreddev/x/blogo"
"forge.capytal.company/loreddev/x/blogo/gitea"
)
func TestSource(t *testing.T) {
plugin := gitea.New("loreddev", "x", "https://forge.capytal.company")
s := plugin.(blogo.SourcerPlugin)
fs, err := s.Source()
if err != nil {
t.Fatalf("Failed to source file system: %s %v", err.Error(), err)
}
file, err := fs.Open("blogo/LICENSE")
if err != nil {
t.Fatalf("Failed to open file: %s %v", err.Error(), err)
}
contents, err := io.ReadAll(file)
if err != nil {
t.Fatalf("Failed to read contents of file: %s %v", err.Error(), err)
}
t.Logf("Successfully read contents of file: %s", string(contents))
}