func TestCreateBaseHtmlData(t *testing.T) { validContent := "1234 XXX-TOPBAR-XXX XXX-BODY-XXX XXX-INDEX-XXX XXX-BOTTOMBAR-XXX 1234" path := test.CreateTestFileReturnPath("foo.html", validContent) loadedData := LoadBaseHtmlData(path) if validContent != loadedData { t.Error("content of baseHtml was not correctly loaded !") } }
func TestCreateConfigData(t *testing.T) { path := test.CreateTestFileReturnPath("foo.json", test.ConfigDataContent) created := CreateConfigData(path) if created.Topbar != test.ConfigDataTopBar { t.Error("expected value : " + test.ConfigDataTopBar + " but was : " + created.Topbar) } if created.Bottombar != test.ConfigDataBottomBar { t.Error("expected value : " + test.ConfigDataBottomBar + " but was : " + created.Bottombar) } if created.TitleType != test.ConfigDataTitleAndCatgoryType { t.Error("expected value : " + test.ConfigDataTitleAndCatgoryType + " but was : " + created.TitleType) } if created.IndexName != test.ConfigDataIndexName { t.Error("expected value : " + test.ConfigDataIndexName + " but was : " + created.IndexName) } }
func TestCreateConfigDataWrongFile(t *testing.T) { path := test.CreateTestFileReturnPath("foo.json", test.ConfigDataContent+"asdf asdf") testCreateConfigExpectException("error while opening configFile", path+"234", t) }
func TestCreateBaseHtmlDataMissingPlaceHolder4(t *testing.T) { path := test.CreateTestFileReturnPath("foo.html", test.ConfigDataContent+"XXX-TOPBAR-XXX XXX-BODY-XXX XXX-INDEX-XXX") testLoadBaseHtmlDataExpectException("the baseHtml didn't contain all required placeholders - missing XXX-BOTTOMBAR-XXX", path, t) }
func TestCreateBaseHtmlDataWrongFile(t *testing.T) { path := test.CreateTestFileReturnPath("foo.html", "") testLoadBaseHtmlDataExpectException("error while opening baseHtmlData", path+"234", t) }
func TestCheckFilePathForOutputFolderExists(t *testing.T) { filename := test.CreateTestFileReturnPath("validEnding.yaml", "") filename2 := test.CreateTestFileReturnPath("validEnding.html", "") workingDir := test.GetTestPath() testAndExpectPanic(filename, filename2, workingDir, filename+"sdf", "argument error - directory does not exist", t) }
func TestLoadContentDataWrongPath(t *testing.T) { path := test.CreateTestFileReturnPath("foo.html", test.ContentData) testLoadContentDataExpectException("error path has to point to a directory", path, t) }
func TestCheckFilePathForContentFolderIsADirectory(t *testing.T) { filename := test.CreateTestFileReturnPath("validEnding.yaml", "") filename2 := test.CreateTestFileReturnPath("validEnding.html", "") testAndExpectPanic(filename, filename2, filename2, "asdf", "argument error - is not a directory", t) }
func TestCheckDirectoryExistsForContentFolder(t *testing.T) { filename := test.CreateTestFileReturnPath("validEnding.yaml", "") filename2 := test.CreateTestFileReturnPath("validEnding.html", "") testAndExpectPanic(filename, filename2, "asdf", "asdf", "argument error - directory does not exist", t) }
func TestCheckFileHasCorrectEndingForBaseHtml(t *testing.T) { filename := test.CreateTestFileReturnPath("validEnding.yaml", "") filename2 := test.CreateTestFileReturnPath("fileWithWrongEnding.txt", "") testAndExpectPanic(filename, filename2, "asdf", "asdf", "argument error - file has incorrect file ending", t) }
func TestCheckFileExistsForBaseHtml(t *testing.T) { filename := test.CreateTestFileReturnPath("validEnding.yaml", "") testAndExpectPanic(filename, "asdf", "asdf", "asdf", "argument error - file does not exist", t) }
func TestCheckFileHasCorrectEndingForConfigFile(t *testing.T) { filename := test.CreateTestFileReturnPath("fileWithWrongEnding.txt", "") testAndExpectPanic(filename, "asdf", "asdf", "asdf", "argument error - file has incorrect file ending", t) }