Skip to content

Commit 5ac30a5

Browse files
test: updated existing tests for streaming changes
1 parent c17c385 commit 5ac30a5

File tree

3 files changed

+88
-68
lines changed

3 files changed

+88
-68
lines changed

internal/print/print.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ func Run(dep *c.Dependencies, ctx *c.Context, options *Options) func(*cobra.Comm
143143
return func(_ *cobra.Command, _ []string) {
144144

145145
monitors, _ := mon.NewMonitor(mon.ConfigMonitor{
146-
Config: ctx.Config,
147-
Reference: ctx.Reference,
146+
ClientHttp: dep.HttpClients.Default,
147+
Config: ctx.Config,
148+
Reference: ctx.Reference,
148149
})
149150
assetGroupQuote := quote.GetAssetGroupQuote(monitors, dep)(ctx.Groups[0])
150151
assets, _ := asset.GetAssets(*ctx, assetGroupQuote)
@@ -164,8 +165,9 @@ func RunSummary(dep *c.Dependencies, ctx *c.Context, options *Options) func(cmd
164165
return func(_ *cobra.Command, _ []string) {
165166

166167
monitors, _ := mon.NewMonitor(mon.ConfigMonitor{
167-
Config: ctx.Config,
168-
Reference: ctx.Reference,
168+
ClientHttp: dep.HttpClients.Default,
169+
Config: ctx.Config,
170+
Reference: ctx.Reference,
169171
})
170172
assetGroupQuote := quote.GetAssetGroupQuote(monitors, dep)(ctx.Groups[0])
171173
_, holdingSummary := asset.GetAssets(*ctx, assetGroupQuote)

internal/sorter/sorter_test.go

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ var _ = Describe("Sorter", func() {
9090
IsRegularTradingSession: false,
9191
},
9292
}
93-
assets := []c.Asset{
94-
bitcoinQuote,
95-
twQuote,
96-
googleQuote,
97-
msftQuote,
93+
assets := []*c.Asset{
94+
&bitcoinQuote,
95+
&twQuote,
96+
&googleQuote,
97+
&msftQuote,
9898
}
9999

100100
When("providing no sort parameter", func() {
@@ -114,23 +114,23 @@ var _ = Describe("Sorter", func() {
114114
IsRegularTradingSession: false,
115115
},
116116
}
117-
assets := []c.Asset{
118-
rblxQuote,
119-
bitcoinQuote,
120-
twQuote,
121-
googleQuote,
122-
msftQuote,
123-
coinQuote,
117+
assets := []*c.Asset{
118+
&rblxQuote,
119+
&bitcoinQuote,
120+
&twQuote,
121+
&googleQuote,
122+
&msftQuote,
123+
&coinQuote,
124124
}
125125

126126
sortedQuotes := sorter(assets)
127-
expected := []c.Asset{
128-
bitcoinQuote,
129-
twQuote,
130-
googleQuote,
131-
coinQuote,
132-
rblxQuote,
133-
msftQuote,
127+
expected := []*c.Asset{
128+
&bitcoinQuote,
129+
&twQuote,
130+
&googleQuote,
131+
&coinQuote,
132+
&rblxQuote,
133+
&msftQuote,
134134
}
135135

136136
Expect(sortedQuotes).To(Equal(expected))
@@ -141,11 +141,11 @@ var _ = Describe("Sorter", func() {
141141
sorter := NewSorter("alpha")
142142

143143
sortedQuotes := sorter(assets)
144-
expected := []c.Asset{
145-
bitcoinQuote,
146-
googleQuote,
147-
msftQuote,
148-
twQuote,
144+
expected := []*c.Asset{
145+
&bitcoinQuote,
146+
&googleQuote,
147+
&msftQuote,
148+
&twQuote,
149149
}
150150

151151
Expect(sortedQuotes).To(Equal(expected))
@@ -164,21 +164,21 @@ var _ = Describe("Sorter", func() {
164164
msftQuoteWithHolding := msftQuote
165165
msftQuoteWithHolding.Holding.Value = 100.00
166166

167-
assets := []c.Asset{
168-
bitcoinQuoteWithHolding,
169-
twQuote,
170-
googleQuoteWithHolding,
171-
msftQuoteWithHolding,
172-
rblxQuoteWithHolding,
167+
assets := []*c.Asset{
168+
&bitcoinQuoteWithHolding,
169+
&twQuote,
170+
&googleQuoteWithHolding,
171+
&msftQuoteWithHolding,
172+
&rblxQuoteWithHolding,
173173
}
174174

175175
sortedQuotes := sorter(assets)
176-
expected := []c.Asset{
177-
bitcoinQuoteWithHolding,
178-
googleQuoteWithHolding,
179-
twQuote,
180-
rblxQuoteWithHolding,
181-
msftQuoteWithHolding,
176+
expected := []*c.Asset{
177+
&bitcoinQuoteWithHolding,
178+
&googleQuoteWithHolding,
179+
&twQuote,
180+
&rblxQuoteWithHolding,
181+
&msftQuoteWithHolding,
182182
}
183183

184184
Expect(sortedQuotes).To(Equal(expected))
@@ -189,11 +189,11 @@ var _ = Describe("Sorter", func() {
189189
sorter := NewSorter("user")
190190

191191
sortedQuotes := sorter(assets)
192-
expected := []c.Asset{
193-
googleQuote,
194-
bitcoinQuote,
195-
twQuote,
196-
msftQuote,
192+
expected := []*c.Asset{
193+
&googleQuote,
194+
&bitcoinQuote,
195+
&twQuote,
196+
&msftQuote,
197197
}
198198

199199
Expect(sortedQuotes).To(Equal(expected))
@@ -204,35 +204,35 @@ var _ = Describe("Sorter", func() {
204204
It("should return no quotes", func() {
205205
sorter := NewSorter("")
206206

207-
sortedQuotes := sorter([]c.Asset{})
208-
expected := []c.Asset{}
207+
sortedQuotes := sorter([]*c.Asset{})
208+
expected := []*c.Asset{}
209209
Expect(sortedQuotes).To(Equal(expected))
210210
})
211211
})
212212
When("alpha sorter", func() {
213213
It("should return no quotes", func() {
214214
sorter := NewSorter("alpha")
215215

216-
sortedQuotes := sorter([]c.Asset{})
217-
expected := []c.Asset{}
216+
sortedQuotes := sorter([]*c.Asset{})
217+
expected := []*c.Asset{}
218218
Expect(sortedQuotes).To(Equal(expected))
219219
})
220220
})
221221
When("value sorter", func() {
222222
It("should return no quotes", func() {
223223
sorter := NewSorter("value")
224224

225-
sortedQuotes := sorter([]c.Asset{})
226-
expected := []c.Asset{}
225+
sortedQuotes := sorter([]*c.Asset{})
226+
expected := []*c.Asset{}
227227
Expect(sortedQuotes).To(Equal(expected))
228228
})
229229
})
230230
When("user sorter", func() {
231231
It("should return no quotes", func() {
232232
sorter := NewSorter("user")
233233

234-
sortedQuotes := sorter([]c.Asset{})
235-
expected := []c.Asset{}
234+
sortedQuotes := sorter([]*c.Asset{})
235+
expected := []*c.Asset{}
236236
Expect(sortedQuotes).To(Equal(expected))
237237
})
238238
})

0 commit comments

Comments
 (0)