mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
chore: daily nip-research-agent run
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
ecdc29c40d
commit
b8cbf7ca84
8 files changed
+154
-17
No files matched your search
@@ -0,0 +1,35 @@
|
||||
|
||||
import { normalizeHexPubkey } from '../js/utils/nostrHelpers.js';
|
||||
|
||||
// Mock window.NostrTools
|
||||
global.window = {
|
||||
NostrTools: {
|
||||
nip19: {
|
||||
decode: (str) => {
|
||||
if (str.startsWith('npub1')) return { type: 'npub', data: 'hexpubkey' };
|
||||
if (str.startsWith('nprofile1')) return { type: 'nprofile', data: { pubkey: 'hexpubkey' } };
|
||||
throw new Error('Invalid');
|
||||
},
|
||||
npubEncode: (hex) => 'npub1' + hex
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
console.log('Testing normalizeHexPubkey with various inputs...');
|
||||
|
||||
const hex = '0000000000000000000000000000000000000000000000000000000000000001';
|
||||
const npub = 'npub1test';
|
||||
const nprofile = 'nprofile1test';
|
||||
|
||||
const resHex = normalizeHexPubkey(hex);
|
||||
console.log(`Hex input: ${resHex === hex ? 'PASS' : 'FAIL'} (${resHex})`);
|
||||
|
||||
const resNpub = normalizeHexPubkey(npub);
|
||||
console.log(`Npub input: ${resNpub === 'hexpubkey' ? 'PASS' : 'FAIL'} (${resNpub})`);
|
||||
|
||||
const resNprofile = normalizeHexPubkey(nprofile);
|
||||
console.log(`Nprofile input: ${resNprofile === 'hexpubkey' ? 'PASS' : 'FAIL'} (${resNprofile})`);
|
||||
|
||||
if (resNprofile !== 'hexpubkey') {
|
||||
console.log('Confirmed: nprofile is NOT handled by normalizeHexPubkey.');
|
||||
}
|
||||
Reference in new issue
Block a user