MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestGetTokenBalance

Function TestGetTokenBalance

client/driver_test.go:213–245  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestGetTokenBalance(t *testing.T) {
214 Convey("test get token balance", t, func() {
215 var stopTestService func()
216 var err error
217 // reset driver not initialized
218 atomic.StoreUint32(&driverInitialized, 0)
219
220 // driver not initialized
221 _, err = GetTokenBalance(types.Particle)
222 So(err, ShouldEqual, ErrNotInitialized)
223
224 // fake driver initialized
225 atomic.StoreUint32(&driverInitialized, 1)
226 _, err = GetTokenBalance(types.Particle)
227 So(err, ShouldNotBeNil)
228 // reset driver not initialized
229 atomic.StoreUint32(&driverInitialized, 0)
230
231 stopTestService, _, err = startTestService()
232 So(err, ShouldBeNil)
233 defer stopTestService()
234
235 var balance uint64
236 balance, err = GetTokenBalance(types.Particle)
237
238 So(err, ShouldBeNil)
239 So(balance, ShouldEqual, 0)
240
241 balance, err = GetTokenBalance(-1)
242
243 So(err, ShouldEqual, ErrNoSuchTokenBalance)
244 })
245}
246
247func TestWaitDBCreation(t *testing.T) {
248 Convey("test WaitDBCreation", t, func() {

Callers

nothing calls this directly

Calls 2

GetTokenBalanceFunction · 0.85
startTestServiceFunction · 0.85

Tested by

no test coverage detected