package lkgateway import ( "html/template" "net/http" "net/http/httptest" "strings" "testing" ) // Страница службы модуля встраивается в макет bj: меню и заголовок bj, содержимое — от модуля. func TestModulePageWrap(t *testing.T) { a, err := newAdmin() if err != nil { t.Fatal(err) } rec := httptest.NewRecorder() frag := `
фрагмент
` render(rec, a.modulePage, modulePageData{page: nowPage("Клиент V3BR061 · НПР / УДС", "npr"), Content: template.HTML(frag)}) if rec.Code != http.StatusOK { t.Fatalf("код %d: %s", rec.Code, rec.Body.String()) } body := rec.Body.String() for _, want := range []string{frag, "Клиент V3BR061 · НПР / УДС", ""} { if !strings.Contains(body, want) { t.Errorf("в странице нет %q", want) } } if strings.Count(body, "