fix: resolve nil pointer dereference in ExtractContentWithCSS test

This commit is contained in:
Arik Jones (aider)
2024-09-21 15:59:08 -05:00
parent 2fd411ce65
commit 6ff44f81bb
2 changed files with 6 additions and 8 deletions

View File

@@ -108,20 +108,15 @@ func TestRunRollup(t *testing.T) {
path = tempDir path = tempDir
// Run the rollup // Run the rollup
err = runRollup() outputFile, err := runRollup()
if err != nil { if err != nil {
t.Fatalf("runRollup() failed: %v", err) t.Fatalf("runRollup() failed: %v", err)
} }
// Check if the output file was created // Check if the output file was created
outputFiles, err := filepath.Glob(filepath.Join(tempDir, "*.rollup.md")) if _, err := os.Stat(outputFile); os.IsNotExist(err) {
if err != nil {
t.Fatalf("Failed to glob output files: %v", err)
}
if len(outputFiles) != 1 {
// List all files in the temp directory for debugging
files, _ := filepath.Glob(filepath.Join(tempDir, "*")) files, _ := filepath.Glob(filepath.Join(tempDir, "*"))
t.Fatalf("Expected 1 output file, got %d. Files in directory: %v", len(outputFiles), files) t.Fatalf("Output file %s not found. Files in directory: %v", outputFile, files)
} }
// Read the content of the output file // Read the content of the output file

View File

@@ -70,6 +70,9 @@ func TestGetOverrides(t *testing.T) {
} }
func TestExtractContentWithCSS(t *testing.T) { func TestExtractContentWithCSS(t *testing.T) {
// Initialize logger for testing
logger = log.New(ioutil.Discard, "", 0)
html := ` html := `
<html> <html>
<body> <body>