@@ -52,11 +52,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
52
52
53
53
when ("Constructing a new ConfigManager" , func () {
54
54
it ("applies the default configuration when user config is missing" , func () {
55
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
55
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
56
56
mockConfigStore .EXPECT ().Read ().Return (types.Config {}, errors .New ("no such file" )).Times (1 )
57
57
58
- subject , err := configmanager .New (mockConfigStore )
59
- Expect (err ).NotTo (HaveOccurred ())
58
+ subject := configmanager .New (mockConfigStore )
60
59
61
60
Expect (subject .Config .Model ).To (Equal (defaultModel ))
62
61
Expect (subject .Config .MaxTokens ).To (Equal (defaultMaxTokens ))
@@ -67,11 +66,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
67
66
it ("gives precedence to the user provided model" , func () {
68
67
userModel := "the-model"
69
68
70
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
69
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
71
70
mockConfigStore .EXPECT ().Read ().Return (types.Config {Model : userModel }, nil ).Times (1 )
72
71
73
- subject , err := configmanager .New (mockConfigStore )
74
- Expect (err ).NotTo (HaveOccurred ())
72
+ subject := configmanager .New (mockConfigStore )
75
73
76
74
Expect (subject .Config .Model ).To (Equal (userModel ))
77
75
Expect (subject .Config .MaxTokens ).To (Equal (defaultMaxTokens ))
@@ -82,11 +80,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
82
80
it ("gives precedence to the user provided max-tokens" , func () {
83
81
userMaxTokens := 42
84
82
85
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
83
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
86
84
mockConfigStore .EXPECT ().Read ().Return (types.Config {MaxTokens : userMaxTokens }, nil ).Times (1 )
87
85
88
- subject , err := configmanager .New (mockConfigStore )
89
- Expect (err ).NotTo (HaveOccurred ())
86
+ subject := configmanager .New (mockConfigStore )
90
87
91
88
Expect (subject .Config .Model ).To (Equal (defaultModel ))
92
89
Expect (subject .Config .MaxTokens ).To (Equal (userMaxTokens ))
@@ -97,11 +94,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
97
94
it ("gives precedence to the user provided URL" , func () {
98
95
userURL := "the-user-url"
99
96
100
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
97
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
101
98
mockConfigStore .EXPECT ().Read ().Return (types.Config {URL : userURL }, nil ).Times (1 )
102
99
103
- subject , err := configmanager .New (mockConfigStore )
104
- Expect (err ).NotTo (HaveOccurred ())
100
+ subject := configmanager .New (mockConfigStore )
105
101
106
102
Expect (subject .Config .Model ).To (Equal (defaultModel ))
107
103
Expect (subject .Config .MaxTokens ).To (Equal (defaultMaxTokens ))
@@ -112,11 +108,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
112
108
it ("gives precedence to the user provided completions-path" , func () {
113
109
completionsPath := "the-completions-path"
114
110
115
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
111
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
116
112
mockConfigStore .EXPECT ().Read ().Return (types.Config {CompletionsPath : completionsPath }, nil ).Times (1 )
117
113
118
- subject , err := configmanager .New (mockConfigStore )
119
- Expect (err ).NotTo (HaveOccurred ())
114
+ subject := configmanager .New (mockConfigStore )
120
115
121
116
Expect (subject .Config .Model ).To (Equal (defaultModel ))
122
117
Expect (subject .Config .MaxTokens ).To (Equal (defaultMaxTokens ))
@@ -127,11 +122,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
127
122
it ("gives precedence to the user provided models-path" , func () {
128
123
modelsPath := "the-models-path"
129
124
130
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
125
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
131
126
mockConfigStore .EXPECT ().Read ().Return (types.Config {ModelsPath : modelsPath }, nil ).Times (1 )
132
127
133
- subject , err := configmanager .New (mockConfigStore )
134
- Expect (err ).NotTo (HaveOccurred ())
128
+ subject := configmanager .New (mockConfigStore )
135
129
136
130
Expect (subject .Config .Model ).To (Equal (defaultModel ))
137
131
Expect (subject .Config .MaxTokens ).To (Equal (defaultMaxTokens ))
@@ -143,11 +137,10 @@ func testConfig(t *testing.T, when spec.G, it spec.S) {
143
137
144
138
when ("WriteModel()" , func () {
145
139
it ("writes the expected config file" , func () {
146
- mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig , nil ).Times (1 )
140
+ mockConfigStore .EXPECT ().ReadDefaults ().Return (defaultConfig ).Times (1 )
147
141
mockConfigStore .EXPECT ().Read ().Return (defaultConfig , nil ).Times (1 )
148
142
149
- subject , err := configmanager .New (mockConfigStore )
150
- Expect (err ).NotTo (HaveOccurred ())
143
+ subject := configmanager .New (mockConfigStore )
151
144
152
145
modelName := "the-model"
153
146
subject .Config .Model = modelName
0 commit comments