mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
parent
d953e39e63
commit
8da040342e
12 changed files with 296 additions and 129 deletions
|
@ -14,13 +14,12 @@
|
|||
package hugolib
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/hugo/source"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
@ -50,15 +49,10 @@ func TestSitemapOutput(t *testing.T) {
|
|||
t.Fatalf("Failed to build site: %s", err)
|
||||
}
|
||||
|
||||
sitemapFile, err := hugofs.Destination().Open("public/sitemap.xml")
|
||||
sitemapContent := readDestination(t, "public/sitemap.xml")
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to locate: sitemap.xml")
|
||||
}
|
||||
|
||||
sitemap := helpers.ReaderToBytes(sitemapFile)
|
||||
if !bytes.HasPrefix(sitemap, []byte("<?xml")) {
|
||||
t.Errorf("Sitemap file should start with <?xml. %s", sitemap)
|
||||
if !strings.HasPrefix(sitemapContent, "<?xml") {
|
||||
t.Errorf("Sitemap file should start with <?xml. %s", sitemapContent)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue