mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
Add testifylint to lint checks (#4535)
go-require lint is ignored for now Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
parent
94933470cd
commit
4de909747b
504 changed files with 5028 additions and 4680 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// HTMLDoc struct
|
||||
|
@ -21,7 +22,7 @@ type HTMLDoc struct {
|
|||
func NewHTMLParser(t testing.TB, body *bytes.Buffer) *HTMLDoc {
|
||||
t.Helper()
|
||||
doc, err := goquery.NewDocumentFromReader(body)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
return &HTMLDoc{doc: doc}
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ func (doc *HTMLDoc) AssertDropdown(t testing.TB, name string) *goquery.Selection
|
|||
t.Helper()
|
||||
|
||||
dropdownGroup := doc.Find(fmt.Sprintf(".dropdown:has(input[name='%s'])", name))
|
||||
assert.Equal(t, dropdownGroup.Length(), 1, fmt.Sprintf("%s dropdown does not exist", name))
|
||||
assert.Equal(t, 1, dropdownGroup.Length(), fmt.Sprintf("%s dropdown does not exist", name))
|
||||
return dropdownGroup
|
||||
}
|
||||
|
||||
|
@ -50,7 +51,7 @@ func (doc *HTMLDoc) AssertDropdownHasOptions(t testing.TB, dropdownName string)
|
|||
t.Helper()
|
||||
|
||||
options := doc.AssertDropdown(t, dropdownName).Find(".menu [data-value]:not([data-value=''])")
|
||||
assert.Greater(t, options.Length(), 0, fmt.Sprintf("%s dropdown has no options", dropdownName))
|
||||
assert.Positive(t, options.Length(), 0, fmt.Sprintf("%s dropdown has no options", dropdownName))
|
||||
}
|
||||
|
||||
func (doc *HTMLDoc) AssertDropdownHasSelectedOption(t testing.TB, dropdownName, expectedValue string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue