1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-08 06:55:28 +02:00

fix general section_test.go

This commit is contained in:
Elliott Stoneham 2016-05-23 15:09:36 +01:00
parent 77849d175f
commit 0f73e5b299

View file

@ -11,7 +11,6 @@
package section package section
/* TODO(Elliott)
import ( import (
"net/http" "net/http"
@ -19,7 +18,7 @@ import (
) )
type testsection struct { type testsection struct {
didFetch bool didRefresh bool
} }
var ts testsection var ts testsection
@ -28,9 +27,13 @@ func init() {
sectionsMap["testsection"] = &ts sectionsMap["testsection"] = &ts
} }
// Fetch runs ... // Command is an end-point...
func (ts *testsection) Fetch(w http.ResponseWriter, r *http.Request) { func (ts *testsection) Command(w http.ResponseWriter, r *http.Request) {}
ts.didFetch = true
// Refresh existing data ...
func (ts *testsection) Refresh(meta, data string) string {
ts.didRefresh = true
return ""
} }
// Render converts ... // Render converts ...
@ -50,11 +53,11 @@ func (*testsection) Meta() TypeMeta {
} }
func TestSection(t *testing.T) { func TestSection(t *testing.T) {
if ok := Fetch("testsection", nil, nil); !ok { if _,ok := Refresh("testsection", "", ""); !ok {
t.Error("did not find 'testsection' smart section (1)") t.Error("did not find 'testsection' smart section (1)")
} }
if !ts.didFetch { if !ts.didRefresh {
t.Error("did not run the test Fetch method") t.Error("did not run the test Refresh method")
} }
out, ok := Render("testsection", "meta", "dingbat") out, ok := Render("testsection", "meta", "dingbat")
if !ok { if !ok {
@ -63,12 +66,8 @@ func TestSection(t *testing.T) {
if out != "testsection dingbat" { if out != "testsection dingbat" {
t.Error("wrong output from Render") t.Error("wrong output from Render")
} }
for k := range sectionsMap { sects := GetSectionMeta()
t.Log(k)
}
sects := GetRegisteredSections()
for _, v := range sects { for _, v := range sects {
t.Logf("%v %v", v.Order, v.Title) t.Logf("%v %v", v.Order, v.Title)
} }
} }
*/