-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapplication_creation_test.go
More file actions
61 lines (55 loc) · 1.5 KB
/
application_creation_test.go
File metadata and controls
61 lines (55 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package modular
import (
"testing"
)
func TestNewApplication(t *testing.T) {
type args struct {
cfgProvider ConfigProvider
logger Logger
}
cp := NewStdConfigProvider(testCfg{Str: "test"})
log := &logger{}
tests := []struct {
name string
args args
expectedLogger Logger
}{
{
name: "TestNewApplication",
args: args{
cfgProvider: nil,
logger: nil,
},
expectedLogger: nil,
},
{
name: "TestNewApplicationWithConfigProviderAndLogger",
args: args{
cfgProvider: cp,
logger: log,
},
expectedLogger: log,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := NewStdApplication(tt.args.cfgProvider, tt.args.logger)
// Test functional properties
if got.ConfigProvider() != tt.args.cfgProvider {
t.Errorf("NewStdApplication().ConfigProvider() = %v, want %v", got.ConfigProvider(), tt.args.cfgProvider)
}
if got.Logger() != tt.expectedLogger {
t.Errorf("NewStdApplication().Logger() = %v, want %v", got.Logger(), tt.expectedLogger)
}
// Check that logger service is properly registered
svcRegistry := got.SvcRegistry()
if svcRegistry["logger"] != tt.expectedLogger {
t.Errorf("NewStdApplication() logger service = %v, want %v", svcRegistry["logger"], tt.expectedLogger)
}
// Verify config sections is initialized (empty map)
if len(got.ConfigSections()) != 0 {
t.Errorf("NewStdApplication().ConfigSections() should be empty, got %v", got.ConfigSections())
}
})
}
}