BlueWallet/tests/unit/contact-list.test.ts

34 lines
1 KiB
TypeScript
Raw Normal View History

2024-05-15 22:46:54 +01:00
import assert from 'assert';
import { ContactList } from '../../class/contact-list';
describe('ContactList', () => {
it('isAddressValid()', () => {
const cl = new ContactList();
assert.ok(cl.isAddressValid('3BDsBDxDimYgNZzsqszNZobqQq3yeUoJf2'));
assert.ok(cl.isAddressValid('bc1quuafy8htjjj263cvpj7md84magzmc8svmh8lrm'));
assert.ok(cl.isAddressValid('BC1QH6TF004TY7Z7UN2V5NTU4MKF630545GVHS45U7'));
assert.ok(!cl.isAddressValid('sfhsdhsdf'));
});
2024-05-15 22:46:54 +01:00
it('isPaymentCodeValid()', async () => {
2024-05-27 23:00:28 +01:00
const cl = new ContactList();
2024-05-15 22:46:54 +01:00
assert.ok(!cl.isPaymentCodeValid('sfdgsfdghsfd'));
assert.ok(
cl.isPaymentCodeValid(
'PM8TJS2JxQ5ztXUpBBRnpTbcUXbUHy2T1abfrb3KkAAtMEGNbey4oumH7Hc578WgQJhPjBxteQ5GHHToTYHE3A1w6p7tU6KSoFmWBVbFGjKPisZDbP97',
),
);
2024-05-30 14:54:29 +01:00
assert.ok(
cl.isPaymentCodeValid(
'sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqjuexzk6murw56suy3e0rd2cgqvycxttddwsvgxe2usfpxumr70xc9pkqwv',
),
);
assert.ok(!cl.isPaymentCodeValid('sp1qq'));
2024-05-15 22:46:54 +01:00
});
});