added test case for qr code

This commit is contained in:
Vishal 2022-11-27 20:33:53 +05:30
parent 7594939571
commit 531ea1f649
2 changed files with 32 additions and 8 deletions

View File

@ -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");

View File

@ -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 ;