Reorganized directories and packages.
This commit is contained in:
parent
1018d82d13
commit
72ce41c828
61 changed files with 83 additions and 83 deletions
39
pkg/funcmap/funcmap_test.go
Normal file
39
pkg/funcmap/funcmap_test.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package funcmap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/mikestefanello/pagoda/config"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHasField(t *testing.T) {
|
||||
type example struct {
|
||||
name string
|
||||
}
|
||||
var e example
|
||||
assert.True(t, HasField(e, "name"))
|
||||
assert.False(t, HasField(e, "abcd"))
|
||||
}
|
||||
|
||||
func TestLink(t *testing.T) {
|
||||
link := string(Link("/abc", "Text", "/abc"))
|
||||
expected := `<a class="is-active" href="/abc">Text</a>`
|
||||
assert.Equal(t, expected, link)
|
||||
|
||||
link = string(Link("/abc", "Text", "/abc", "first", "second"))
|
||||
expected = `<a class="first second is-active" href="/abc">Text</a>`
|
||||
assert.Equal(t, expected, link)
|
||||
|
||||
link = string(Link("/abc", "Text", "/def"))
|
||||
expected = `<a class="" href="/abc">Text</a>`
|
||||
assert.Equal(t, expected, link)
|
||||
}
|
||||
|
||||
func TestGetFuncMap(t *testing.T) {
|
||||
file := File("test.png")
|
||||
expected := fmt.Sprintf("/%s/test.png?v=%s", config.StaticPrefix, CacheBuster)
|
||||
assert.Equal(t, expected, file)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue