Mass Block [bsky] Reposts [and more]
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: add resolveMiniDoc shape validation and test cleanup

Winter d19f4abf 58b265db

+6 -3
+3 -1
index.js
··· 80 80 `https://slingshot.microcosm.blue/xrpc/blue.microcosm.identity.resolveMiniDoc?identifier=${encodeURIComponent(identifier)}` 81 81 ); 82 82 if (!res.ok) throw new Error(`slingshot identity error for ${identifier}: ${res.status}`); 83 - return res.json(); 83 + const doc = await res.json(); 84 + if (typeof doc?.did !== "string") throw new Error(`unexpected slingshot response for ${identifier}`); 85 + return doc; 84 86 } 85 87 86 88 async function resolveHandle(handle) {
+3 -2
test.js
··· 18 18 assert.equal(isProfileUrl("https://bsky.app/search"), false); 19 19 }); 20 20 21 - test("resolveMiniDoc returns did, handle, pds for a known handle", async (t) => { 21 + test("resolveMiniDoc returns did, handle, pds for a known handle", async () => { 22 22 // bad-example.com is slingshot's own example account -- stable 23 23 const result = await resolveMiniDoc("bad-example.com"); 24 24 assert.equal(typeof result.did, "string"); ··· 28 28 assert.ok(result.pds.startsWith("https://")); 29 29 }); 30 30 31 - test("resolveMiniDoc accepts a DID as identifier", async (t) => { 31 + test("resolveMiniDoc accepts a DID as identifier", async () => { 32 32 // did:plc:hdhoaan3xa3jiuq4fg4mefid is bad-example.com per slingshot docs 33 33 const result = await resolveMiniDoc("did:plc:hdhoaan3xa3jiuq4fg4mefid"); 34 34 assert.equal(typeof result.did, "string"); 35 35 assert.equal(typeof result.pds, "string"); 36 + assert.equal(typeof result.handle, "string"); 36 37 });