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

Function TestTransferToken

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

Source from the content-addressed store, hash-verified

276}
277
278func TestTransferToken(t *testing.T) {
279 Convey("test TransferToken to a address", t, func() {
280 var stopTestService func()
281 var err error
282 var user proto.AccountAddress
283
284 // driver not initialized
285 _, err = TransferToken(user, 100, types.Particle)
286 So(err, ShouldEqual, ErrNotInitialized)
287
288 // fake driver initialized
289 atomic.StoreUint32(&driverInitialized, 1)
290 _, err = TransferToken(user, 100, types.Particle)
291 So(err, ShouldNotBeNil)
292 // reset driver not initialized
293 atomic.StoreUint32(&driverInitialized, 0)
294
295 stopTestService, _, err = startTestService()
296 So(err, ShouldBeNil)
297 defer stopTestService()
298
299 // with mock bp, any params will be success
300 txHash, err := TransferToken(user, 100, types.Particle)
301 So(err, ShouldBeNil)
302
303 ctx := context.Background()
304 _, err = WaitTxConfirmation(ctx, txHash)
305 So(err, ShouldBeNil)
306 })
307}
308
309func TestUpdatePermission(t *testing.T) {
310 Convey("test UpdatePermission to a address", t, func() {

Callers

nothing calls this directly

Calls 3

TransferTokenFunction · 0.85
startTestServiceFunction · 0.85
WaitTxConfirmationFunction · 0.85

Tested by

no test coverage detected