1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-03 00:27:47 +01:00
gojekyll/pages/page_test.go

27 lines
655 B
Go
Raw Normal View History

2017-07-04 23:36:06 +02:00
package pages
import (
"bytes"
"testing"
2017-07-07 01:31:36 +02:00
"github.com/osteele/gojekyll/config"
2017-07-04 23:36:06 +02:00
"github.com/stretchr/testify/require"
)
2017-07-13 18:28:02 +02:00
func TestPage_Categories(t *testing.T) {
s := siteFake{t, config.Default()}
fm := map[string]interface{}{"categories": "b a"}
f := file{site: s, frontMatter: fm}
p := page{file: f}
require.Equal(t, []string{"a", "b"}, p.Categories())
}
2017-07-04 23:36:06 +02:00
2017-07-13 18:28:02 +02:00
func TestPage_Write(t *testing.T) {
2017-07-07 01:31:36 +02:00
cfg := config.Default()
2017-07-10 19:23:51 +02:00
p, err := NewFile(siteFake{t, cfg}, "testdata/page_with_layout.md", "page_with_layout.md", map[string]interface{}{})
2017-07-04 23:36:06 +02:00
require.NoError(t, err)
require.NotNil(t, p)
buf := new(bytes.Buffer)
2017-07-10 19:23:51 +02:00
require.NoError(t, p.Write(buf))
2017-07-04 23:36:06 +02:00
}