mirror of
https://github.com/tnypxl/rollup.git
synced 2025-12-15 15:03:17 +00:00
fix: resolve nil pointer dereference in ExtractContentWithCSS test
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user