Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodonato committed Jun 25, 2024
1 parent 7a90118 commit a33be54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions server/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func (s *FileHandlerTestSuite) TestListingHTML() {
s.Equal(http.StatusOK, response.StatusCode)
s.Equal("text/html; charset=utf-8", response.Header.Get("Content-Type"))
content := w.Body.String()
s.Contains(content, `<a href="bar" class="col col-name type-file" tabindex="1">bar</a>`)
s.Contains(content, `<a href="baz/" class="col col-name type-dir" tabindex="2">baz/</a>`)
s.Contains(content, `<a href="foo" class="col col-name type-file" tabindex="3">foo</a>`)
s.Contains(content, `<a title="bar" href="bar" class="col col-name type-file" tabindex="1">bar</a>`)
s.Contains(content, `<a title="baz/" href="baz/" class="col col-name type-dir" tabindex="2">baz/</a>`)
s.Contains(content, `<a title="foo" href="foo" class="col col-name type-file" tabindex="3">foo</a>`)
// The root directory doesn't contain a link up
s.NotContains(content, `<a href=".." class="col col-name type-dir-up">..</a>`)
}
Expand All @@ -92,7 +92,7 @@ func (s *FileHandlerTestSuite) TestListingHTMLSubdir() {
s.Equal(http.StatusOK, response.StatusCode)
s.Equal("text/html; charset=utf-8", response.Header.Get("Content-Type"))
content := w.Body.String()
s.Contains(content, `<a href=".." class="col col-name type-dir-up">..</a>`)
s.Contains(content, `<a title="Up one directory" href=".." class="col col-name type-dir-up">..</a>`)
}

// File content is served.
Expand Down
6 changes: 3 additions & 3 deletions server/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func (s *DirectoryListingTemplateTestSuite) TestRenderHTML() {
s.Equal(http.StatusOK, response.StatusCode)
s.Equal("text/html; charset=utf-8", response.Header.Get("Content-Type"))
content := w.Body.String()
s.Contains(content, `<a href="bar" class="col col-name type-file" tabindex="1">bar</a>`)
s.Contains(content, `<a href="baz/" class="col col-name type-dir" tabindex="2">baz/</a>`)
s.Contains(content, `<a href="foo" class="col col-name type-file" tabindex="3">foo</a>`)
s.Contains(content, `<a title="bar" href="bar" class="col col-name type-file" tabindex="1">bar</a>`)
s.Contains(content, `<a title="baz/" href="baz/" class="col col-name type-dir" tabindex="2">baz/</a>`)
s.Contains(content, `<a title="foo" href="foo" class="col col-name type-file" tabindex="3">foo</a>`)
}

// RenderHTML renders the HTML template with the correct path prefix.
Expand Down

0 comments on commit a33be54

Please sign in to comment.