1- import { encode , decode as _decode } from '../index.js'
1+ import * as bip21 from '../index.js'
22import fixtures from './fixtures.json' assert { type : 'json ' }
33const { valid, invalid } = fixtures
44import tape from 'tape'
@@ -9,9 +9,9 @@ valid.forEach(function (f) {
99 tape ( 'encodes ' + f . uri , function ( t ) {
1010 let result
1111 if ( f . urnScheme ) {
12- result = encode ( f . address , f . options , f . urnScheme )
12+ result = bip21 . encode ( f . address , f . options , f . urnScheme )
1313 } else {
14- result = encode ( f . address , f . options )
14+ result = bip21 . encode ( f . address , f . options )
1515 }
1616
1717 t . plan ( 1 )
@@ -22,9 +22,9 @@ valid.forEach(function (f) {
2222 tape ( 'decodes ' + f . uri + ( f . compliant === false ? ' (non-compliant)' : '' ) , function ( t ) {
2323 let decode
2424 if ( f . urnScheme ) {
25- decode = _decode ( f . uri , f . urnScheme )
25+ decode = bip21 . decode ( f . uri , f . urnScheme )
2626 } else {
27- decode = _decode ( f . uri )
27+ decode = bip21 . decode ( f . uri )
2828 }
2929
3030 t . plan ( f . options ? 4 : 1 )
@@ -42,7 +42,7 @@ invalid.forEach(function (f) {
4242 tape ( 'throws ' + f . exception + ' for ' + f . uri , function ( t ) {
4343 t . plan ( 1 )
4444 t . throws ( function ( ) {
45- encode ( f . address , f . options )
45+ bip21 . encode ( f . address , f . options )
4646 } , new RegExp ( f . exception ) )
4747 } )
4848 }
@@ -51,7 +51,7 @@ invalid.forEach(function (f) {
5151 tape ( 'throws ' + f . exception + ' for ' + f . uri , function ( t ) {
5252 t . plan ( 1 )
5353 t . throws ( function ( ) {
54- _decode ( f . uri )
54+ bip21 . decode ( f . uri )
5555 } , new RegExp ( f . exception ) )
5656 } )
5757 }
0 commit comments