test.ts
40 lines 1.1 kB view raw
1import { TestPds, TestPlc } from "@atproto/dev-env"; 2import consola from "consola"; 3 4async function main() { 5 const plc = await TestPlc.create({ 6 port: 2580, 7 }); 8 9 const pds = await TestPds.create({ 10 didPlcUrl: plc.url, 11 port: 2583, 12 }); 13 14 const client = pds.getClient(); 15 16 await client.createAccount({ 17 handle: "test-account.test", 18 password: "password-test", 19 email: "email.test@example.com", 20 }); 21 22 consola.info("Logged in:", client.did); 23 24 await client.post({ 25 text: "test", 26 }); 27} 28 29main(); 30 31/* results in: 32 33$ deno run -A ./test.ts 34[4:33:16 PM] ℹ Logged in: did:plc:eidpn3m5v6lvdgbezyjaxio6 35error: Uncaught (in promise) Error: Internal Server Error 36 at AtpAgent.call (file:///workspaces/airport/node_modules/.deno/@atproto+xrpc@0.7.2/node_modules/@atproto/xrpc/dist/xrpc-client.js:75:23) 37 at eventLoopTick (ext:core/01_core.js:179:7) 38 at async AppBskyFeedPostRecord.create (file:///workspaces/airport/node_modules/.deno/@atproto+api@0.16.3/node_modules/@atproto/api/dist/client/index.js:955:21) 39 at async main (file:///workspaces/airport/test.ts:24:3) 40*/