mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-30 08:28:58 +01:00
24 lines
689 B
Go
24 lines
689 B
Go
package plugins
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"github.com/osteele/gojekyll/config"
|
|
"github.com/osteele/liquid"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGistTag(t *testing.T) {
|
|
engine := liquid.NewEngine()
|
|
plugins := []string{"jekyll-gist"}
|
|
_ = Install(plugins, siteFake{config.Default(), engine})
|
|
require.NoError(t, directory[plugins[0]].ConfigureTemplateEngine(engine))
|
|
|
|
s, err := engine.ParseAndRenderString(`{% gist parkr/931c1c8d465a04042403 %}`, liquid.Bindings{})
|
|
require.NoError(t, err)
|
|
re := regexp.MustCompile(`<script.*>\s*</script>`)
|
|
require.Contains(t, s, `src=https://gist.github.com/parkr/931c1c8d465a04042403.js`)
|
|
require.True(t, re.MatchString(s))
|
|
}
|