2017-07-07 01:31:36 +02:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/osteele/gojekyll/config"
|
2017-07-09 01:57:41 +02:00
|
|
|
"github.com/osteele/liquid"
|
2017-07-07 01:31:36 +02:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPage_ToLiquid(t *testing.T) {
|
|
|
|
cfg := config.Default()
|
2017-07-10 19:23:51 +02:00
|
|
|
page, err := NewFile(siteFake{t, cfg}, "testdata/excerpt.md", "excerpt.md", map[string]interface{}{})
|
2017-07-07 01:31:36 +02:00
|
|
|
require.NoError(t, err)
|
2017-07-09 01:57:41 +02:00
|
|
|
drop := page.(liquid.Drop).ToLiquid()
|
2017-07-07 01:31:36 +02:00
|
|
|
excerpt := drop.(map[string]interface{})["excerpt"]
|
|
|
|
// FIXME the following probably isn't right
|
|
|
|
// TODO also test post-rendering.
|
|
|
|
require.Equal(t, "First line.", excerpt)
|
|
|
|
}
|