@@ -15,10 +15,12 @@ import (
15
15
16
16
// todo: finish unit tests!
17
17
18
- var testLockingScript = "76a9147ff514e6ae3deb46e6644caac5cdd0bf2388906588ac"
19
- var testAddressID = "fc1e635d98151c6008f29908ee2928c60c745266f9853e945c917b1baa05973e"
20
- var testDestinationID = "c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646"
21
- var stasHex = "76a9146d3562a8ec96bcb3b2253fd34f38a556fb66733d88ac6976aa607f5f7f7c5e7f7c5d7f7c5c7f7c5b7f7c5a7f7c597f7c587f7c577f7c567f7c557f7c547f7c537f7c527f7c517f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7c5f7f7c5e7f7c5d7f7c5c7f7c5b7f7c5a7f7c597f7c587f7c577f7c567f7c557f7c547f7c537f7c527f7c517f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e01007e818b21414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff007d976e7c5296a06394677768827601249301307c7e23022079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798027e7c7e7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e01417e21038ff83d8cf12121491609c4939dc11c4aa35503508fe432dc5a5c1905608b9218ad547f7701207f01207f7701247f517f7801007e8102fd00a063546752687f7801007e817f727e7b01177f777b557a766471567a577a786354807e7e676d68aa880067765158a569765187645294567a5379587a7e7e78637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6867567a6876aa587a7d54807e577a597a5a7a786354807e6f7e7eaa727c7e676d6e7eaa7c687b7eaa587a7d877663516752687c72879b69537a647500687c7b547f77517f7853a0916901247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f77788c6301247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f777852946301247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f77686877517f7c52797d8b9f7c53a09b91697c76638c7c587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f777c6876638c7c587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f777c6863587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f7768587f517f7801007e817602fc00a06302fd00a063546752687f7801007e81727e7b7b687f75537f7c0376a9148801147f775379645579887567726881766968789263556753687a76026c057f7701147f8263517f7c766301007e817f7c6775006877686b537992635379528763547a6b547a6b677c6b567a6b537a7c717c71716868547a587f7c81547a557964936755795187637c686b687c547f7701207f75748c7a7669765880748c7a76567a876457790376a9147e7c7e557967041976a9147c7e0288ac687e7e5579636c766976748c7a9d58807e6c0376a9147e748c7a7e6c7e7e676c766b8263828c007c80517e846864745aa0637c748c7a76697d937b7b58807e56790376a9147e748c7a7e55797e7e6868686c567a5187637500678263828c007c80517e846868647459a0637c748c7a76697d937b7b58807e55790376a9147e748c7a7e55797e7e687459a0637c748c7a76697d937b7b58807e55790376a9147e748c7a7e55797e7e68687c537a9d547963557958807e041976a91455797e0288ac7e7e68aa87726d77776a14f566909f378788e61108d619e40df2757455d14c010005546f6b656e"
18
+ var (
19
+ testLockingScript = "76a9147ff514e6ae3deb46e6644caac5cdd0bf2388906588ac"
20
+ testAddressID = "fc1e635d98151c6008f29908ee2928c60c745266f9853e945c917b1baa05973e"
21
+ testDestinationID = "c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646"
22
+ stasHex = "76a9146d3562a8ec96bcb3b2253fd34f38a556fb66733d88ac6976aa607f5f7f7c5e7f7c5d7f7c5c7f7c5b7f7c5a7f7c597f7c587f7c577f7c567f7c557f7c547f7c537f7c527f7c517f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7c5f7f7c5e7f7c5d7f7c5c7f7c5b7f7c5a7f7c597f7c587f7c577f7c567f7c557f7c547f7c537f7c527f7c517f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e01007e818b21414136d08c5ed2bf3ba048afe6dcaebafeffffffffffffffffffffffffffffff007d976e7c5296a06394677768827601249301307c7e23022079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798027e7c7e7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c8276638c687f7c7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e01417e21038ff83d8cf12121491609c4939dc11c4aa35503508fe432dc5a5c1905608b9218ad547f7701207f01207f7701247f517f7801007e8102fd00a063546752687f7801007e817f727e7b01177f777b557a766471567a577a786354807e7e676d68aa880067765158a569765187645294567a5379587a7e7e78637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6878637c8c7c53797e577a7e6867567a6876aa587a7d54807e577a597a5a7a786354807e6f7e7eaa727c7e676d6e7eaa7c687b7eaa587a7d877663516752687c72879b69537a647500687c7b547f77517f7853a0916901247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f77788c6301247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f777852946301247f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e816854937f77686877517f7c52797d8b9f7c53a09b91697c76638c7c587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f777c6876638c7c587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f777c6863587f77517f7c01007e817602fc00a06302fd00a063546752687f7c01007e81687f7768587f517f7801007e817602fc00a06302fd00a063546752687f7801007e81727e7b7b687f75537f7c0376a9148801147f775379645579887567726881766968789263556753687a76026c057f7701147f8263517f7c766301007e817f7c6775006877686b537992635379528763547a6b547a6b677c6b567a6b537a7c717c71716868547a587f7c81547a557964936755795187637c686b687c547f7701207f75748c7a7669765880748c7a76567a876457790376a9147e7c7e557967041976a9147c7e0288ac687e7e5579636c766976748c7a9d58807e6c0376a9147e748c7a7e6c7e7e676c766b8263828c007c80517e846864745aa0637c748c7a76697d937b7b58807e56790376a9147e748c7a7e55797e7e6868686c567a5187637500678263828c007c80517e846868647459a0637c748c7a76697d937b7b58807e55790376a9147e748c7a7e55797e7e687459a0637c748c7a76697d937b7b58807e55790376a9147e748c7a7e55797e7e68687c537a9d547963557958807e041976a91455797e0288ac7e7e68aa87726d77776a14f566909f378788e61108d619e40df2757455d14c010005546f6b656e"
23
+ )
22
24
23
25
// TestDestination_newDestination will test the method newDestination()
24
26
func TestDestination_newDestination (t * testing.T ) {
@@ -86,7 +88,6 @@ func TestDestination_newAddress(t *testing.T) {
86
88
assert .Equal (t , bscript2 .ScriptTypePubKeyHash , address .Type )
87
89
assert .Equal (t , testAddressID , address .GetID ())
88
90
})
89
-
90
91
}
91
92
92
93
// TestDestination_GetModelName will test the method GetModelName()
@@ -126,7 +127,6 @@ func TestDestination_GetID(t *testing.T) {
126
127
127
128
// TestDestination_setAddress will test the method setAddress()
128
129
func TestDestination_setAddress (t * testing.T ) {
129
-
130
130
t .Run ("internal 1" , func (t * testing.T ) {
131
131
destination := newDestination (testXPubID , testLockingScript )
132
132
destination .Chain = utils .ChainInternal
@@ -166,9 +166,8 @@ func TestDestination_setAddress(t *testing.T) {
166
166
167
167
// TestDestination_getDestinationByID will test the method getDestinationByID()
168
168
func TestDestination_getDestinationByID (t * testing.T ) {
169
-
170
169
t .Run ("does not exist" , func (t * testing.T ) {
171
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
170
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
172
171
defer deferMe ()
173
172
174
173
xPub , err := getDestinationByID (ctx , testDestinationID , client .DefaultModelOptions ()... )
@@ -177,7 +176,7 @@ func TestDestination_getDestinationByID(t *testing.T) {
177
176
})
178
177
179
178
t .Run ("get" , func (t * testing.T ) {
180
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
179
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
181
180
defer deferMe ()
182
181
183
182
destination := newDestination (testXPubID , testLockingScript , client .DefaultModelOptions ()... )
@@ -198,9 +197,8 @@ func TestDestination_getDestinationByID(t *testing.T) {
198
197
199
198
// TestDestination_getDestinationByAddress will test the method getDestinationByAddress()
200
199
func TestDestination_getDestinationByAddress (t * testing.T ) {
201
-
202
200
t .Run ("does not exist" , func (t * testing.T ) {
203
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
201
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
204
202
defer deferMe ()
205
203
206
204
xPub , err := getDestinationByAddress (ctx , testExternalAddress , client .DefaultModelOptions ()... )
@@ -209,7 +207,7 @@ func TestDestination_getDestinationByAddress(t *testing.T) {
209
207
})
210
208
211
209
t .Run ("get" , func (t * testing.T ) {
212
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
210
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
213
211
defer deferMe ()
214
212
215
213
destination := newDestination (testXPubID , testLockingScript , client .DefaultModelOptions ()... )
@@ -230,9 +228,8 @@ func TestDestination_getDestinationByAddress(t *testing.T) {
230
228
231
229
// TestDestination_getDestinationByLockingScript will test the method getDestinationByLockingScript()
232
230
func TestDestination_getDestinationByLockingScript (t * testing.T ) {
233
-
234
231
t .Run ("does not exist" , func (t * testing.T ) {
235
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
232
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
236
233
defer deferMe ()
237
234
238
235
xPub , err := getDestinationByLockingScript (ctx , testLockingScript , client .DefaultModelOptions ()... )
@@ -241,7 +238,7 @@ func TestDestination_getDestinationByLockingScript(t *testing.T) {
241
238
})
242
239
243
240
t .Run ("get destination" , func (t * testing.T ) {
244
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , WithCustomTaskManager ( & taskManagerMockBase {} ))
241
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , false , withTaskManagerMockup ( ))
245
242
defer deferMe ()
246
243
247
244
destination := newDestination (testXPubID , testLockingScript , client .DefaultModelOptions ()... )
@@ -269,9 +266,8 @@ func BenchmarkDestination_newAddress(b *testing.B) {
269
266
270
267
// TestClient_NewDestination will test the method NewDestination()
271
268
func TestClient_NewDestination (t * testing.T ) {
272
-
273
269
t .Run ("valid - simple destination" , func (t * testing.T ) {
274
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , WithCustomTaskManager ( & taskManagerMockBase {} ))
270
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , withTaskManagerMockup ( ))
275
271
defer deferMe ()
276
272
277
273
// Get new random key
@@ -304,7 +300,7 @@ func TestClient_NewDestination(t *testing.T) {
304
300
})
305
301
306
302
t .Run ("error - invalid xPub" , func (t * testing.T ) {
307
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , WithCustomTaskManager ( & taskManagerMockBase {} ))
303
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , withTaskManagerMockup ( ))
308
304
defer deferMe ()
309
305
310
306
opts := append (
@@ -324,7 +320,7 @@ func TestClient_NewDestination(t *testing.T) {
324
320
})
325
321
326
322
t .Run ("error - xPub not found" , func (t * testing.T ) {
327
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , WithCustomTaskManager ( & taskManagerMockBase {} ))
323
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , withTaskManagerMockup ( ))
328
324
defer deferMe ()
329
325
330
326
opts := append (
@@ -345,7 +341,7 @@ func TestClient_NewDestination(t *testing.T) {
345
341
})
346
342
347
343
t .Run ("error - unsupported destination type" , func (t * testing.T ) {
348
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , WithCustomTaskManager ( & taskManagerMockBase {} ))
344
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , withTaskManagerMockup ( ))
349
345
defer deferMe ()
350
346
351
347
// Get new random key
@@ -369,7 +365,7 @@ func TestClient_NewDestination(t *testing.T) {
369
365
})
370
366
371
367
t .Run ("stas token" , func (t * testing.T ) {
372
- ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , WithCustomTaskManager ( & taskManagerMockBase {} ))
368
+ ctx , client , deferMe := CreateTestSQLiteClient (t , false , true , withTaskManagerMockup ( ))
373
369
defer deferMe ()
374
370
375
371
// Get new random key
0 commit comments