lnlink

iOS app for connecting to lightning nodes
git clone git://jb55.com/lnlink
Log | Files | Refs | Submodules | README | LICENSE

lightninglinkTests.swift (1955B)


      1 //
      2 //  lightninglinkTests.swift
      3 //  lightninglinkTests
      4 //
      5 //  Created by William Casarin on 2022-01-07.
      6 //
      7 
      8 import XCTest
      9 @testable import lightninglink
     10 
     11 class lightninglinkTests: XCTestCase {
     12 
     13     override func setUpWithError() throws {
     14         // Put setup code here. This method is called before the invocation of each test method in the class.
     15         XCTAssert(false)
     16     }
     17 
     18     override func tearDownWithError() throws {
     19         // Put teardown code here. This method is called after the invocation of each test method in the class.
     20     }
     21     
     22     func test_parse_lnurl() throws {
     23         let lnurl = "LNURL1DP68GURN8GHJ7UM9WFMXJCM99E3K7MF0V9CXJ0M385EKVCENXC6R2C35XVUKXEFCV5MKVV34X5EKZD3EV56NYD3HXQURZEPEXEJXXEPNXSCRVWFNV9NXZCN9XQ6XYEFHVGCXXCMYXYMNSERXFQ5FNS"
     24         
     25         let m_decode = decode_bech32(lnurl)
     26         XCTAssert(m_decode != nil)
     27         let decode = m_decode!
     28         
     29         XCTAssert(decode.hrp == "LNURL")
     30     }
     31 
     32     func testAnyAmountParsesOk() throws {
     33         let inv = "lnbc1p3psxjypp5335lq3qyr4vaexez53yxac5jfatdavwyq5eskkkvnrx6yw9j75vsdqvw3jhxarpdeusxqyjw5qcqpjsp5z65t0t70q4e6yp0t2rcajwslkz6uqmaw2eu5s3fkdfgaf5sdm7vsrzjqv7cv43pj3u8qy38rxwt6mm8qv6u34qg4y4w3zuk93yafhqws0sz2z2z0yqq40qqqqqqqqlgqqqqqeqqjq9qyyssqd432fhw3shf0l3zy0l3ku3xv8re6lhaayeyr8u0ayfcy46348vrzjsa46j7prz70l34wklyennpk7dzsw8eqacde74z92jylvevvdhgpzcxhyn"
     34 
     35         let mamt = parseInvoiceString(inv)
     36 
     37         XCTAssert(mamt != nil)
     38         let amt = mamt!
     39 
     40         switch amt {
     41         case .amount:
     42             XCTAssert(false)
     43         case .any:
     44             XCTAssert(true)
     45         }
     46         // This is an example of a functional test case.
     47         // Use XCTAssert and related functions to verify your tests produce the correct results.
     48     }
     49 
     50     func testPerformanceExample() throws {
     51         // This is an example of a performance test case.
     52         self.measure {
     53             // Put the code you want to measure the time of here.
     54         }
     55     }
     56 
     57 }