fixed static files init

This commit is contained in:
Niko Abeler 2022-08-05 22:13:14 +02:00
parent 3f48211ffb
commit 5739a9348c
2 changed files with 15 additions and 1 deletions

View File

@ -42,7 +42,7 @@ func CreateRepository(name string) (Repository, error) {
if file.IsDir() {
continue
}
src_data, _ := static_files.ReadFile(file.Name())
src_data, _ := static_files.ReadFile("embed/initial/static/" + file.Name())
os.WriteFile(newRepo.StaticDir()+"/"+file.Name(), src_data, 0644)
}

View File

@ -167,6 +167,20 @@ func TestNewRepoGetsStaticFiles(t *testing.T) {
}
}
func TestNewRepoGetsStaticFilesPicoCSSWithContent(t *testing.T) {
// Create a new user
repo, _ := owl.CreateRepository(testRepoName())
file, err := os.Open(path.Join(repo.StaticDir(), "pico.min.css"))
if err != nil {
t.Error("Error opening pico.min.css")
}
// check that the file has content
stat, _ := file.Stat()
if stat.Size() == 0 {
t.Error("pico.min.css is empty")
}
}
func TestNewRepoGetsBaseHtml(t *testing.T) {
// Create a new user
repo, _ := owl.CreateRepository(testRepoName())