Refactor folder structure

This commit is contained in:
Joakim Hellsén 2024-02-13 21:21:08 +01:00
commit c7cca02ca7
30 changed files with 610 additions and 933 deletions

30
tests/html_test.go Normal file
View file

@ -0,0 +1,30 @@
package main
import (
"strings"
"testing"
"github.com/TheLovinator1/FeedVault/pkg/html"
"github.com/TheLovinator1/FeedVault/pkg/models"
)
// Displays error messages if there are any parse errors
func TestErrorMessages(t *testing.T) {
// Initialize test data
parseResult := []models.ParseResult{
{IsError: true, Msg: "Error 1"},
{IsError: true, Msg: "Error 2"},
}
h := html.HTMLData{
ParseResult: parseResult,
}
// Invoke function under test
result := html.FullHTML(h)
// Assert that the result contains the error messages
if !strings.Contains(result, "Error 1") || !strings.Contains(result, "Error 2") {
t.Errorf("Expected error messages, but got: %s", result)
}
}