open-source, lexicon-agnostic PDS for AI agents. welcome-mat enrollment, AT Proto federation.
agents atprotocol pds cloudflare
7
fork

Configure Feed

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

Fix test compatibility after merge of welcome-mat-auth

- identity.test.ts: add tosText to config, swap createApp arg order
- auth.test.ts: mock fetch for PLC directory calls (real impl now posts to PLC)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+21 -4
+17 -1
test/auth.test.ts
··· 1 1 import crypto from "node:crypto"; 2 - import { describe, expect, it } from "vitest"; 2 + import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; 3 3 import { createApp } from "../src/app.js"; 4 4 import { DEFAULT_TOS_TEXT, type Config } from "../src/config.js"; 5 5 import { initDatabase } from "../src/db.js"; ··· 195 195 }); 196 196 197 197 describe("POST /api/signup", () => { 198 + beforeEach(() => { 199 + vi.stubGlobal("fetch", async () => new Response("", { status: 200 })); 200 + }); 201 + 202 + afterEach(() => { 203 + vi.unstubAllGlobals(); 204 + }); 205 + 198 206 it("full signup flow returns did, handle, access_token, token_type", async () => { 199 207 const { app, config, db } = createTestApp(); 200 208 const { response, accessToken } = await performSignup(app, config, { handle: "agent" }); ··· 444 452 }); 445 453 446 454 describe("auth middleware", () => { 455 + beforeEach(() => { 456 + vi.stubGlobal("fetch", async () => new Response("", { status: 200 })); 457 + }); 458 + 459 + afterEach(() => { 460 + vi.unstubAllGlobals(); 461 + }); 462 + 447 463 it("passes valid DPoP + access token, returns account info", async () => { 448 464 const { app, config } = createTestApp(); 449 465 const signup = await performSignup(app, config, { handle: "agent" });
+4 -3
test/identity.test.ts
··· 4 4 import { fromString } from "uint8arrays/from-string"; 5 5 import { toString } from "uint8arrays/to-string"; 6 6 import { createApp } from "../src/app.js"; 7 - import type { Config } from "../src/config.js"; 7 + import { DEFAULT_TOS_TEXT, type Config } from "../src/config.js"; 8 8 import { initDatabase } from "../src/db.js"; 9 9 import { 10 10 buildUnsignedGenesisOp, ··· 18 18 plcUrl: "https://plc.test", 19 19 dbPath: ":memory:", 20 20 port: 3000, 21 + tosText: DEFAULT_TOS_TEXT, 21 22 }; 22 23 23 24 describe("identity", () => { ··· 120 121 it("resolves handles through the xrpc route", async () => { 121 122 db.prepare("INSERT INTO accounts (did, handle) VALUES (?, ?)") 122 123 .run("did:plc:agenttestexample1234", "agent.test.example"); 123 - const app = createApp(db, testConfig); 124 + const app = createApp(testConfig, db); 124 125 125 126 const okRes = await app.request( 126 127 "/xrpc/com.atproto.identity.resolveHandle?handle=agent.test.example", ··· 150 151 it("serves dids from the well-known endpoint by host header", async () => { 151 152 db.prepare("INSERT INTO accounts (did, handle) VALUES (?, ?)") 152 153 .run("did:plc:agenttestexample1234", "agent.test.example"); 153 - const app = createApp(db, testConfig); 154 + const app = createApp(testConfig, db); 154 155 155 156 const okRes = await app.request("http://localhost/.well-known/atproto-did", { 156 157 headers: { host: "agent.test.example" },