Improve test coverage

This commit is contained in:
Dan Jones 2025-01-27 11:41:32 -06:00
commit d7de194a90
4 changed files with 75 additions and 0 deletions

View file

@ -78,6 +78,31 @@ func TestService(t *testing.T) {
}
}
func TestAppStorage(t *testing.T) {
th := setupAppTest(t)
base := "http://localhost:1234/"
th.conf.EXPECT().BaseURL().Return(base).MinTimes(1)
th.conf.EXPECT().Name().Return("").AnyTimes()
a, er := NewApp("0.0.0.0", th.conf, th.store)
assert.NoError(t, er)
if assert.NotNil(t, a) {
assert.Equal(t, th.store, a.Storage())
}
}
func TestAppUser(t *testing.T) {
// TODO: Actually fill this out at some point
th := setupAppTest(t)
base := "http://localhost:1234/"
th.conf.EXPECT().BaseURL().Return(base).MinTimes(1)
th.conf.EXPECT().Name().Return("").AnyTimes()
a, er := NewApp("0.0.0.0", th.conf, th.store)
assert.NoError(t, er)
if assert.NotNil(t, a) {
assert.Zero(t, a.User())
}
}
func TestStrings(t *testing.T) {
cases := [...]struct {
given string