diff --git a/lib/console_ui.dart b/lib/console_ui.dart index eb668f8..5ad73db 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -342,6 +342,16 @@ void printProfile(Store node, String profilePubkey) { pronoun = "They"; } + // print QR code + print("The QR code for public key:\n\n"); + try { + print(getQrCodeAsString(profilePubkey)); + } catch(e) { + print("Could not generate qr code. \n"); + } + + print(""); + print("\nName : $authorName ( ${profilePubkey} )."); if (profileContactEvent != null ) { @@ -356,14 +366,6 @@ void printProfile(Store node, String profilePubkey) { print("Nip 05 : ${verified?"yes. ${nip05Id}":"no"}"); print("\nLast Updated: ${getPrintableDate(dateLastUpdated)}\n"); - // print QR code - print("The QR code for the public key:\n\n"); - try { - print(getQrCodeAsString(profilePubkey)); - } catch(e) { - print("Could not generate qr code. \n"); - } - if( profilePubkey != userPublicKey) { if( profileContactEvent.eventData.contactList.any((x) => (x.id == userPublicKey))) { print("* They follow you"); diff --git a/test/nostr_console_test.dart b/test/nostr_console_test.dart index 1ecc7c0..0abeb83 100644 --- a/test/nostr_console_test.dart +++ b/test/nostr_console_test.dart @@ -1,3 +1,4 @@ +import 'package:nostr_console/console_ui.dart'; import 'package:nostr_console/event_ds.dart'; import 'package:nostr_console/settings.dart'; import 'package:test/test.dart'; @@ -257,6 +258,27 @@ String expectedResult = expect(3046, node.getNumMessagesInChannel('25e5c82273a271cb1a840d0060391a0bf4965cafeb029d5ab55350b418953fbb'), reason:'verify a public channel has correct number of messages'); + String qrCodeResult1 = + """ █▀▀▀▀▀█ ██▄▄▀ ▄▄ █ ▄▀ █▀▀▀▀▀█ + █ ███ █ █▄█ ██▄ ▄▄ ██▀▀ █ ███ █ + █ ▀▀▀ █ ▀ ▀ █▀▄█▄███ ██ █ ▀▀▀ █ + ▀▀▀▀▀▀▀ ▀ ▀▄█ █▄▀ █ █▄█▄▀ ▀▀▀▀▀▀▀ + █ ▀██▄▀▄▀▄▀ █ ▀ ▀▄█▀██ ▀▄▀▄▄▄█▀▀█ + ▄▄█ ▀▄ ▄▄█ ▀█▀█▀▄ ▄▀▀▄▄▄▀▀▀█▀ + ▄█▄ █▀ █▄ ▀▀▄█▀▀███ ▀▀▄ ▀ ▄▄▄ + ▀ ██▀▀▀ ▀ ▄▄▄ █▀█▄▀ ▄██ ▀▀██▀▀ + ▀█▄▄▀█▄ ▄▀▄▀ ▀ ▄▄▄ █ █▄▄▀▀▀███ + ▄ █▀█▄▀▄▄▄ ▄▀█▄█▀ ▀ ██▀█▀█▄▀█ ▀▄█ + ▄▀▀ ▀▀ █▄▄ ▀▀▄▄▄ ▄▀█▄▄▀ ▄▄ ▄ ▄ + ▄▄▄▀ ▀ ▄█▀█ ▀ ██ █▀█▄ █ ▄▀██ ▀ + ▀ ▀▀▀█▀ ▄▄ █ ▀▀ ▀▀▀ █▀▀▀█ █▄ + █▀▀▀▀▀█ ▀█▀▄▄▄▀█▀ ▀▀▀█ ▀ █▄██▄ + █ ███ █ █▄██▀▄▀ ▀▀▀▄▄ ▄▄▀█▀██▄ ██ + █ ▀▀▀ █ ▀█▀▄ ▄█▀███ ▀ ▄ ▀▀▀▄█ ▀ + ▀▀▀▀▀▀▀ ▀▀▀ ▀▀ ▀ ▀▀ ▀ ▀ \n"""; + + String profilePubkey1 = "add06b88bd78c5cbb2cd990e873adfba3eaf8e0217d3208be2be770eb506d430"; + expect (qrCodeResult1, getQrCodeAsString(profilePubkey1), reason: "testing qr code function"); }); return ;