Skip to content

Commit

Permalink
update refresh package to v3
Browse files Browse the repository at this point in the history
* fix broken tests
* update refresh package for abcweb dev command. new refresh no longer
  uses deprecated commands.
  • Loading branch information
nullbio committed Jan 3, 2023
1 parent a1eec84 commit 2e2f4be
Show file tree
Hide file tree
Showing 5 changed files with 555 additions and 206 deletions.
16 changes: 8 additions & 8 deletions abcmiddleware/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ func TestRemoveAndAdd(t *testing.T) {
Handler: nil,
}

m := NewErrorManager(&abcrender.Render{})
m := NewErrorManager(&abcrender.Render{}, "")

m.Add(NewError(ea, 404, "errors/404", nil))
m.Add(NewError(eb, 404, "errors/404", nil))
m.Add(NewError(ea, 404, "", "errors/404", nil))
m.Add(NewError(eb, 404, "", "errors/404", nil))

if len(m.errors) != 2 {
t.Errorf("expected len 2, got %d", len(m.errors))
Expand Down Expand Up @@ -76,8 +76,8 @@ func TestCustomErrorHandler(t *testing.T) {

// test handler route
ea := errors.New("error1")
m := NewErrorManager(&abcrender.Render{})
m.Add(NewError(ea, 404, "errors/404", myHandler))
m := NewErrorManager(&abcrender.Render{}, "")
m.Add(NewError(ea, 404, "", "errors/404", myHandler))
fn := m.Errors(func(w http.ResponseWriter, r *http.Request) error {
return ea
})
Expand All @@ -90,7 +90,7 @@ func TestCustomErrorHandler(t *testing.T) {

// test non-handler non-custom error route
rndr := &mockRender{}
m = NewErrorManager(rndr)
m = NewErrorManager(rndr, "")
fn = m.Errors(func(w http.ResponseWriter, r *http.Request) error {
// generic error that isnt added to error manager
// this should test default case
Expand All @@ -110,8 +110,8 @@ func TestCustomErrorHandler(t *testing.T) {
// test non-handler but custom error route
e1 := errors.New("100 error")
rndr = &mockRender{}
m = NewErrorManager(rndr)
m.Add(NewError(e1, 100, "errors/100", nil))
m = NewErrorManager(rndr, "")
m.Add(NewError(e1, 100, "", "errors/100", nil))
fn = m.Errors(func(w http.ResponseWriter, r *http.Request) error {
// generic error that isnt added to error manager
// this should test default case
Expand Down
2 changes: 1 addition & 1 deletion cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/BurntSushi/toml"
"github.com/spf13/cobra"
"github.com/volatiletech/refresh/refresh"
"github.com/volatiletech/refresh/v3/refresh"
)

// devCmd represents the "dev" command
Expand Down
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.14
require (
github.com/BurntSushi/toml v0.3.1
github.com/djherbis/times v1.2.0
github.com/fatih/color v1.9.0 // indirect
github.com/friendsofgo/errors v0.9.2
github.com/go-chi/chi v4.1.1+incompatible
github.com/go-sql-driver/mysql v1.5.0 // indirect
Expand All @@ -15,14 +14,14 @@ require (
github.com/onsi/gomega v1.9.0 // indirect
github.com/pierrre/archivefile v0.0.0-20170218184037-e2d100bc74f5
github.com/satori/go.uuid v1.2.0
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v1.0.0
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.3
github.com/stretchr/testify v1.3.0
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
github.com/unrolled/render v1.0.3
github.com/volatiletech/mig v1.2.0
github.com/volatiletech/refresh v2.0.0+incompatible
go.uber.org/zap v1.10.0
github.com/volatiletech/refresh/v3 v3.0.4
go.uber.org/zap v1.17.0
gopkg.in/redis.v5 v5.2.9
)
Loading

0 comments on commit 2e2f4be

Please sign in to comment.