Files
pubky-core/pubky-client/pkg/test/http.js
Severin Alexander Bühler 30e5387fd4 fix: Changed default pkarr relays (#131)
* fix: Changed default pkarr relays

* fmt

* Update native.rs
2025-05-16 15:32:02 +03:00

42 lines
837 B
JavaScript

import test from 'tape'
import { Client, Keypair, PublicKey } from '../index.cjs'
const TLD = '8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo';
test("basic fetch", async (t) => {
let client = Client.testnet();
// Normal TLD
{
let response = await client.fetch(`https://google.com/`);
t.equal(response.status, 200);
}
// Pubky
let response = await client.fetch(`https://${TLD}/`);
t.equal(response.status, 200);
})
test("fetch failed", async (t) => {
let client = Client.testnet();
// Normal TLD
{
let response = await client.fetch(`https://nonexistent.domain/`).catch(e => e);
t.ok(response instanceof Error);
}
// Pubky
let response = await client.fetch(`https://1pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ew1/`).catch(e => e);
t.ok(response instanceof Error);
})