Skip to content

Commit

Permalink
minor: Adds method to list organisation and improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoaraujo committed Oct 7, 2023
1 parent 1f3aa6c commit a50f169
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/sponsors/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"renatoaraujo/uk-visa-sponsors/internal/sponsors"
mocks "renatoaraujo/uk-visa-sponsors/internal/sponsors/mocks"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -110,7 +109,11 @@ func TestNewHandler(t *testing.T) {
}

if handler != nil {
assert.IsType(t, &sponsors.Handler{}, handler)
require.IsType(t, &sponsors.Handler{}, handler)
}

if tt.load && !tt.wantErr {
require.NotEmpty(t, handler.Organisations)
}

mock.AssertExpectationsForObjects(t, fetcherMock)
Expand Down
4 changes: 4 additions & 0 deletions internal/sponsors/organisation.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type Organisation struct {
Description string
}

func (o *Organisations) List() []Organisation {
return o.list
}

func (o *Organisations) SearchOrganisationsByName(name string) []Organisation {
var found []Organisation

Expand Down

0 comments on commit a50f169

Please sign in to comment.