コード例 #1
0
ファイル: page_test.go プロジェクト: Stromausfall/ssmpg
func TestCreateIndex(t *testing.T) {
	outputDirectory, configData, elements := setupTestEnvironment("1")

	CreateIndexPage(outputDirectory, configData, elements, test.BaseHtmlContent)
	expected := "Index ||| <p>foo</p>\n ||| <h2>Index</h2>\n<a href=\"content/old-pages.html\">(2015-03-24) Old Pages</a></br>\n ||| <a href=\"index.html\">Index</a></br>\n</br>\n<a href=\"categories/x1.html\">X1</a></br>\n<a href=\"categories/x2.html\">X2</a> ||| <p>© foo</p>\n"

	filePath := filepath.Join(outputDirectory, "index.html")
	result := test.GetTestFileContent(filePath)

	test.TestValues(t, expected, result, "incorrect page generated")
}
コード例 #2
0
ファイル: page_test.go プロジェクト: Stromausfall/ssmpg
func TestCreateContent(t *testing.T) {
	outputDirectory, configData, elements := setupTestEnvironment("3")
	contentPath := filepath.Join(outputDirectory, "content")
	test.CreateTestDirectory(contentPath)
	content := elements[0]

	CreateContentPage(outputDirectory, configData, content, elements, test.BaseHtmlContent)
	expected := "Old Pages ||| <p>foo</p>\n ||| <p>2015-03-24 22:28</p></br>\n<h2>Old Pages</h2>\n<p>Old unsupported pages :</p>\n ||| <a href=\"../index.html\">Index</a></br>\n</br>\n<a href=\"../categories/x1.html\">X1</a></br>\n<a href=\"../categories/x2.html\">X2</a> ||| <p>© foo</p>\n"

	filePath := filepath.Join(contentPath, slug.GenerateSlug(test.ContentDataTitle)+".html")
	result := test.GetTestFileContent(filePath)

	test.TestValues(t, expected, result, "incorrect page generated")
}
コード例 #3
0
ファイル: page_test.go プロジェクト: Stromausfall/ssmpg
func TestCreateCategory(t *testing.T) {
	outputDirectory, configData, elements := setupTestEnvironment("2")
	category := test.ContentDataCategories[0]
	categoryPath := filepath.Join(outputDirectory, "categories")
	test.CreateTestDirectory(categoryPath)

	CreateCategoryPage(outputDirectory, configData, category, elements, test.BaseHtmlContent)
	expected := "X1 ||| <p>foo</p>\n ||| <h2>X1</h2>\n<a href=\"../content/old-pages.html\">(2015-03-24) Old Pages</a></br>\n ||| <a href=\"../index.html\">Index</a></br>\n</br>\n<a href=\"../categories/x1.html\">X1</a></br>\n<a href=\"../categories/x2.html\">X2</a> ||| <p>© foo</p>\n"

	filePath := filepath.Join(categoryPath, slug.GenerateSlug(category)+".html")
	result := test.GetTestFileContent(filePath)

	test.TestValues(t, expected, result, "incorrect page generated")
}