From e1c607c9093e3944206a79d0f752cc9e124425f7 Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Wed, 8 Jan 2025 11:16:23 -0300 Subject: [PATCH] feat(blogo,gitea): minimal testing for the gitea package --- blogo/gitea/gitea_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 blogo/gitea/gitea_test.go diff --git a/blogo/gitea/gitea_test.go b/blogo/gitea/gitea_test.go new file mode 100644 index 0000000..1cea42c --- /dev/null +++ b/blogo/gitea/gitea_test.go @@ -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)) +}