@@ -88,7 +88,7 @@ class ReceiveInvoiceUtilsTest {
8888 }
8989
9090 @Test
91- fun `getInvoiceForTab AUTO returns full BIP21 when node is running` () {
91+ fun `getInvoiceForTab AUTO returns full BIP21 when node running and has lightning ` () {
9292 val bip21 = " bitcoin:$testAddress ?amount=0.001&lightning=$testBolt11 "
9393
9494 val result = getInvoiceForTab(
@@ -104,7 +104,7 @@ class ReceiveInvoiceUtilsTest {
104104 }
105105
106106 @Test
107- fun `getInvoiceForTab AUTO returns empty when node is not running` () {
107+ fun `getInvoiceForTab AUTO returns empty when has lightning but node not running` () {
108108 val bip21 = " bitcoin:$testAddress ?amount=0.001&lightning=$testBolt11 "
109109
110110 val result = getInvoiceForTab(
@@ -119,6 +119,54 @@ class ReceiveInvoiceUtilsTest {
119119 assertEquals(" " , result)
120120 }
121121
122+ @Test
123+ fun `getInvoiceForTab AUTO returns empty when BIP21 has no lightning even if node running` () {
124+ val bip21WithoutLightning = " bitcoin:$testAddress ?amount=0.001&message=Test"
125+
126+ val result = getInvoiceForTab(
127+ tab = ReceiveTab .AUTO ,
128+ bip21 = bip21WithoutLightning,
129+ bolt11 = testBolt11,
130+ cjitInvoice = null ,
131+ isNodeRunning = true ,
132+ onchainAddress = testAddress
133+ )
134+
135+ assertEquals(" " , result)
136+ }
137+
138+ @Test
139+ fun `getInvoiceForTab AUTO returns empty when no lightning and node not running` () {
140+ val bip21WithoutLightning = " bitcoin:$testAddress ?amount=0.001&message=Test"
141+
142+ val result = getInvoiceForTab(
143+ tab = ReceiveTab .AUTO ,
144+ bip21 = bip21WithoutLightning,
145+ bolt11 = testBolt11,
146+ cjitInvoice = null ,
147+ isNodeRunning = false ,
148+ onchainAddress = testAddress
149+ )
150+
151+ assertEquals(" " , result)
152+ }
153+
154+ @Test
155+ fun `getInvoiceForTab AUTO detects lightning when it is the first parameter` () {
156+ val bip21LightningFirst = " bitcoin:$testAddress ?lightning=$testBolt11 &amount=0.001"
157+
158+ val result = getInvoiceForTab(
159+ tab = ReceiveTab .AUTO ,
160+ bip21 = bip21LightningFirst,
161+ bolt11 = testBolt11,
162+ cjitInvoice = null ,
163+ isNodeRunning = true ,
164+ onchainAddress = testAddress
165+ )
166+
167+ assertEquals(bip21LightningFirst, result)
168+ }
169+
122170 @Test
123171 fun `getInvoiceForTab SPENDING returns CJIT invoice when available and node running` () {
124172 val bip21 = " bitcoin:$testAddress ?lightning=$testBolt11 "
0 commit comments