mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
test: fix failed tests after code changes
This commit is contained in:
parent
62d3d200e6
commit
b8c0961de3
6 changed files with 16 additions and 18 deletions
|
@ -37,11 +37,11 @@ func (err *baseError) Subjectf(format string, args ...any) Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err baseError) With(extra error) Error {
|
func (err baseError) With(extra error) Error {
|
||||||
return &nestedError{err.Err, []error{extra}}
|
return &nestedError{&err, []error{extra}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err baseError) Withf(format string, args ...any) Error {
|
func (err baseError) Withf(format string, args ...any) Error {
|
||||||
return &nestedError{err.Err, []error{fmt.Errorf(format, args...)}}
|
return &nestedError{&err, []error{fmt.Errorf(format, args...)}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err *baseError) Error() string {
|
func (err *baseError) Error() string {
|
||||||
|
|
|
@ -45,11 +45,11 @@ func TestFormatting(t *testing.T) {
|
||||||
func TestMultiError(t *testing.T) {
|
func TestMultiError(t *testing.T) {
|
||||||
err := testMultiErr{[]error{testErr{}, testErr{}}}
|
err := testMultiErr{[]error{testErr{}, testErr{}}}
|
||||||
plain := Plain(err)
|
plain := Plain(err)
|
||||||
if string(plain) != "test error\ntest error" {
|
if string(plain) != "test error\ntest error\n" {
|
||||||
t.Errorf("expected test error, got %s", string(plain))
|
t.Errorf("expected test error, got %s", string(plain))
|
||||||
}
|
}
|
||||||
md := Markdown(err)
|
md := Markdown(err)
|
||||||
if string(md) != "**test error**\n**test error**" {
|
if string(md) != "**test error**\n**test error**\n" {
|
||||||
t.Errorf("expected test error, got %s", string(md))
|
t.Errorf("expected test error, got %s", string(md))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,21 +102,19 @@ func TestListWalkxCodeIcons(t *testing.T) {
|
||||||
}
|
}
|
||||||
test := []testCases{
|
test := []testCases{
|
||||||
{
|
{
|
||||||
Key: NewIconKey(IconSourceWalkXCode, "2fauth"),
|
Key: NewIconKey(IconSourceWalkXCode, "app1"),
|
||||||
IconMeta: IconMeta{
|
IconMeta: IconMeta{
|
||||||
SVG: true,
|
SVG: true,
|
||||||
PNG: true,
|
PNG: true,
|
||||||
WebP: true,
|
WebP: true,
|
||||||
Light: true,
|
Light: true,
|
||||||
DisplayName: "2FAuth",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: NewIconKey(IconSourceWalkXCode, "dittofeed"),
|
Key: NewIconKey(IconSourceWalkXCode, "app2"),
|
||||||
IconMeta: IconMeta{
|
IconMeta: IconMeta{
|
||||||
PNG: true,
|
PNG: true,
|
||||||
WebP: true,
|
WebP: true,
|
||||||
DisplayName: "Dittofeed",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ example: # matching `example.y.z`
|
||||||
hideXForwarded:
|
hideXForwarded:
|
||||||
homepage:
|
homepage:
|
||||||
name: Example App
|
name: Example App
|
||||||
icon: png/adguard-home.png
|
icon: "@selfhst/adguard-home.png"
|
||||||
description: An example app
|
description: An example app
|
||||||
category: example
|
category: example
|
||||||
access_log:
|
access_log:
|
||||||
|
|
|
@ -27,7 +27,7 @@ proxy.app: |
|
||||||
hideXForwarded:
|
hideXForwarded:
|
||||||
homepage:
|
homepage:
|
||||||
name: Example App
|
name: Example App
|
||||||
icon: png/adguard-home.png
|
icon: "@selfhst/adguard-home.png"
|
||||||
description: An example app
|
description: An example app
|
||||||
category: example
|
category: example
|
||||||
access_log:
|
access_log:
|
||||||
|
@ -89,7 +89,7 @@ proxy.app1.middlewares.cidr_whitelist: |
|
||||||
message: IP not allowed
|
message: IP not allowed
|
||||||
proxy.app1.middlewares.hideXForwarded:
|
proxy.app1.middlewares.hideXForwarded:
|
||||||
proxy.app1.homepage.name: Example App
|
proxy.app1.homepage.name: Example App
|
||||||
proxy.app1.homepage.icon: png/adguard-home.png
|
proxy.app1.homepage.icon: "@selfhst/adguard-home.png"
|
||||||
proxy.app1.homepage.description: An example app
|
proxy.app1.homepage.description: An example app
|
||||||
proxy.app1.homepage.category: example
|
proxy.app1.homepage.category: example
|
||||||
proxy.app1.access_log.buffer_size: 100
|
proxy.app1.access_log.buffer_size: 100
|
||||||
|
|
|
@ -37,7 +37,7 @@ func ExpectErrorT[T error](t *testing.T, err error) {
|
||||||
|
|
||||||
func ExpectEqual[T any](t *testing.T, got T, want T) {
|
func ExpectEqual[T any](t *testing.T, got T, want T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
require.EqualValues(t, got, want)
|
require.EqualValues(t, want, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExpectContains[T any](t *testing.T, got T, wants []T) {
|
func ExpectContains[T any](t *testing.T, got T, wants []T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue