1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 20:11:18 +01:00
gojekyll/pages/file_test.go
2017-07-07 14:55:24 -04:00

26 lines
648 B
Go

package pages
import (
"path/filepath"
"testing"
"github.com/osteele/gojekyll/config"
"github.com/stretchr/testify/require"
)
type containerFake struct {
cfg config.Config
prefix string
}
func (c containerFake) Config() *config.Config { return &c.cfg }
func (c containerFake) PathPrefix() string { return c.prefix }
func (c containerFake) OutputExt(p string) string { return filepath.Ext(p) }
func TestPageCategories(t *testing.T) {
c := containerFake{config.Default(), ""}
fm := map[string]interface{}{"categories": "b a"}
f := file{container: c, frontMatter: fm}
require.Equal(t, []string{"a", "b"}, f.Categories())
}