Skip to content

Commit a2b2aba

Browse files
authored
Merge pull request #73 from gone-io/feature/loader
docs(inject): update dependency injection documentation and add config_mock.go
2 parents e948f8a + ba90fb6 commit a2b2aba

File tree

4 files changed

+424
-146
lines changed

4 files changed

+424
-146
lines changed

config_mock.go

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"time"
1010
)
1111

12-
// MockConfigure implements Configure interface for testing
13-
type MockConfigure struct {
12+
// SimpleMockConfigure implements Configure interface for testing
13+
type SimpleMockConfigure struct {
1414
values map[string]string
1515
}
1616

17-
func (m *MockConfigure) Get(key string, v any, defaultVal string) error {
17+
func (m *SimpleMockConfigure) Get(key string, v any, defaultVal string) error {
1818
if key == "" {
1919
return errors.New("key is empty")
2020
}
@@ -39,7 +39,7 @@ func TestConfigProvider_Name(t *testing.T) {
3939
}
4040

4141
func TestConfigProvider_Provide(t *testing.T) {
42-
mockConfigure := &MockConfigure{
42+
mockConfigure := &SimpleMockConfigure{
4343
values: map[string]string{
4444
"test-key": `test-value`,
4545
"number-key": "42",
@@ -329,7 +329,7 @@ func TestConfigProvider_Init(t *testing.T) {
329329
}
330330

331331
func TestConfigProvider_ProvideWithDefaultTag(t *testing.T) {
332-
mockConfigure := &MockConfigure{
332+
mockConfigure := &SimpleMockConfigure{
333333
values: map[string]string{},
334334
}
335335

@@ -880,7 +880,7 @@ func TestEnvConfigure_GetEmptyEnvWithDefaults(t *testing.T) {
880880
}
881881

882882
func TestConfigProvider_ProvidePointerType(t *testing.T) {
883-
mockConfigure := &MockConfigure{
883+
mockConfigure := &SimpleMockConfigure{
884884
values: map[string]string{
885885
"ptr-string": "test-value",
886886
},
@@ -988,7 +988,7 @@ func TestEnvConfigure_GetInvalidNumericValues(t *testing.T) {
988988
}
989989

990990
func TestConfigProvider_ProvideMultipleKeys(t *testing.T) {
991-
mockConfigure := &MockConfigure{
991+
mockConfigure := &SimpleMockConfigure{
992992
values: map[string]string{
993993
"second-key": "found-value",
994994
},
@@ -1043,7 +1043,7 @@ func TestConfigProvider_ProvideMultipleKeys(t *testing.T) {
10431043
}
10441044

10451045
func TestConfigProvider_ProvideInvalidJSON(t *testing.T) {
1046-
mockConfigure := &MockConfigure{
1046+
mockConfigure := &SimpleMockConfigure{
10471047
values: map[string]string{
10481048
"invalid-json": "{invalid-json}",
10491049
},
@@ -1128,7 +1128,7 @@ func TestEnvConfigure_GetWithNilValue(t *testing.T) {
11281128
}
11291129

11301130
func TestConfigProvider_ProvideWithInvalidType(t *testing.T) {
1131-
mockConfigure := &MockConfigure{
1131+
mockConfigure := &SimpleMockConfigure{
11321132
values: map[string]string{
11331133
"test-key": "test-value",
11341134
},
@@ -1206,7 +1206,7 @@ func TestEnvConfigure_GetWithComplexTypes(t *testing.T) {
12061206
}
12071207

12081208
func TestConfigProvider_ProvideWithEmptyKeys(t *testing.T) {
1209-
mockConfigure := &MockConfigure{
1209+
mockConfigure := &SimpleMockConfigure{
12101210
values: map[string]string{},
12111211
}
12121212

0 commit comments

Comments
 (0)