mirror of
https://github.com/go-shiori/shiori.git
synced 2025-09-04 12:04:58 +08:00
fix: resolve linting errors and e2e test failures
- Fix ST1005 linting errors by lowercasing error message strings - Fix QF1008 linting errors by removing embedded field selectors in containers.go - Update Alpine version from 3.22 to 3.21 in Makefile to fix Docker image resolution - Update corresponding test expectations for error message changes
This commit is contained in:
parent
9f6a4c39d4
commit
ca949c5dab
7 changed files with 14 additions and 14 deletions
|
@ -60,9 +60,9 @@ func NewShioriContainer(t *testing.T, tag string) ShioriContainer {
|
|||
}
|
||||
|
||||
if tag != "" {
|
||||
containerDefinition.ContainerRequest.Image = "ghcr.io/go-shiori/shiori:" + tag
|
||||
containerDefinition.Image = "ghcr.io/go-shiori/shiori:" + tag
|
||||
} else {
|
||||
containerDefinition.ContainerRequest.FromDockerfile = testcontainers.FromDockerfile{
|
||||
containerDefinition.FromDockerfile = testcontainers.FromDockerfile{
|
||||
PrintBuildLog: false,
|
||||
Context: "../..",
|
||||
Dockerfile: "Dockerfile.e2e",
|
||||
|
|
|
@ -137,7 +137,7 @@ func (pr *PlaywrightRequire) True(t *testing.T, value bool, msgAndArgs ...interf
|
|||
pr.Assert(t, func() error {
|
||||
var err error
|
||||
if !value {
|
||||
err = fmt.Errorf("Expected value to be true but got false in test '%s'", t.Name())
|
||||
err = fmt.Errorf("expected value to be true but got false in test '%s'", t.Name())
|
||||
}
|
||||
return err
|
||||
}, msgAndArgs...)
|
||||
|
@ -149,7 +149,7 @@ func (pr *PlaywrightRequire) False(t *testing.T, value bool, msgAndArgs ...inter
|
|||
pr.Assert(t, func() error {
|
||||
var err error
|
||||
if value {
|
||||
err = fmt.Errorf("Expected value to be false but got true in test '%s'", t.Name())
|
||||
err = fmt.Errorf("expected value to be false but got true in test '%s'", t.Name())
|
||||
}
|
||||
return err
|
||||
}, msgAndArgs...)
|
||||
|
@ -161,7 +161,7 @@ func (pr *PlaywrightRequire) Equal(t *testing.T, expected, actual interface{}, m
|
|||
pr.Assert(t, func() error {
|
||||
var err error
|
||||
if expected != actual {
|
||||
err = fmt.Errorf("Expected values to be equal in test '%s':\nexpected: %v\nactual: %v", t.Name(), expected, actual)
|
||||
err = fmt.Errorf("expected values to be equal in test '%s':\nexpected: %v\nactual: %v", t.Name(), expected, actual)
|
||||
}
|
||||
return err
|
||||
}, msgAndArgs...)
|
||||
|
@ -173,7 +173,7 @@ func (pr *PlaywrightRequire) NoError(t *testing.T, err error, msgAndArgs ...inte
|
|||
pr.Assert(t, func() error {
|
||||
var assertErr error
|
||||
if err != nil {
|
||||
assertErr = fmt.Errorf("Expected no error but got error in test '%s': %v", t.Name(), err)
|
||||
assertErr = fmt.Errorf("expected no error but got error in test '%s': %v", t.Name(), err)
|
||||
}
|
||||
return assertErr
|
||||
}, msgAndArgs...)
|
||||
|
@ -185,7 +185,7 @@ func (pr *PlaywrightRequire) Error(t *testing.T, err error, msgAndArgs ...interf
|
|||
pr.Assert(t, func() error {
|
||||
var assertErr error
|
||||
if err == nil {
|
||||
assertErr = fmt.Errorf("Expected error but got none in test '%s'", t.Name())
|
||||
assertErr = fmt.Errorf("expected error but got none in test '%s'", t.Name())
|
||||
}
|
||||
return assertErr
|
||||
}, msgAndArgs...)
|
||||
|
@ -195,7 +195,7 @@ func (pr *PlaywrightRequire) Error(t *testing.T, err error, msgAndArgs ...interf
|
|||
func (pr *PlaywrightRequire) Contains(t *testing.T, text, expected string, msgAndArgs ...interface{}) {
|
||||
pr.Assert(t, func() error {
|
||||
if !strings.Contains(text, expected) {
|
||||
return fmt.Errorf("Expected text to contain '%s' but got '%s'", expected, text)
|
||||
return fmt.Errorf("expected text to contain '%s' but got '%s'", expected, text)
|
||||
}
|
||||
return nil
|
||||
}, msgAndArgs...)
|
||||
|
|
|
@ -181,7 +181,7 @@ func verifyMetadata(title, url, timeAddedStr, tags string) (string, string, time
|
|||
// Parse time added
|
||||
timeAddedInt, err := strconv.ParseInt(timeAddedStr, 10, 64)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Invalid time added, %w", err)
|
||||
err = fmt.Errorf("invalid time added, %w", err)
|
||||
return "", "", time.Time{}, nil, err
|
||||
}
|
||||
timeAdded := time.Unix(timeAddedInt, 0)
|
||||
|
@ -211,7 +211,7 @@ func handleDuplicates(ctx context.Context, db model.DB, mapURL map[string]struct
|
|||
|
||||
_, exists, err := db.GetBookmark(ctx, 0, url)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed getting bookmark, %w", err)
|
||||
return fmt.Errorf("failed getting bookmark, %w", err)
|
||||
}
|
||||
|
||||
if exists {
|
||||
|
|
|
@ -90,7 +90,7 @@ func (c *HttpConfig) IsValid() error {
|
|||
}
|
||||
|
||||
if c.ServeWebUIV2 && !c.ServeWebUI {
|
||||
return fmt.Errorf("You need to enable serving the Web UI to use the experimental Web UI v2")
|
||||
return fmt.Errorf("you need to enable serving the Web UI to use the experimental Web UI v2")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -25,7 +25,7 @@ func (d *AuthDomain) CheckToken(ctx context.Context, userJWT string) (*model.Acc
|
|||
token, err := jwt.ParseWithClaims(userJWT, &JWTClaim{}, func(token *jwt.Token) (interface{}, error) {
|
||||
// Validate algorithm
|
||||
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
|
||||
return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"])
|
||||
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
|
||||
}
|
||||
|
||||
return d.deps.Config().Http.SecretKey, nil
|
||||
|
|
|
@ -82,7 +82,7 @@ func TestAuthDomainCheckTokenInvalidMethod(t *testing.T) {
|
|||
acc, err := domain.CheckToken(ctx, tokenString)
|
||||
require.Error(t, err)
|
||||
require.Nil(t, acc)
|
||||
require.Contains(t, err.Error(), "Unexpected signing method")
|
||||
require.Contains(t, err.Error(), "unexpected signing method")
|
||||
}
|
||||
|
||||
func TestAuthDomainGetAccountFromCredentials(t *testing.T) {
|
||||
|
|
|
@ -127,7 +127,7 @@ type updateAccountPayload struct {
|
|||
|
||||
func (p *updateAccountPayload) IsValid() error {
|
||||
if p.NewPassword != "" && p.OldPassword == "" {
|
||||
return fmt.Errorf("To update the password the old one must be provided")
|
||||
return fmt.Errorf("to update the password the old one must be provided")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue