matthewwong525/WongStack / .agents/plugins/access
access
VerifiedSee who can sign in and what each person may use; add, change or remove a person.
server/errors.test.mjs
View on GitHubimport { expect, test } from 'vitest';
import { AccessError, boundedJson, reply } from './errors.mjs';
test('bounds JSON streams and cancels malformed, empty and oversized reads', async () => {
expect(await boundedJson(Response.json({ ok: true }), 100)).toEqual({ ok: true });
const stream = new ReadableStream({ start(controller) {
controller.enqueue(new TextEncoder().encode('{"a":')); controller.enqueue(new TextEncoder().encode('1}')); controller.close();
} });
expect(await boundedJson(new Response(stream), 100)).toEqual({ a: 1 });
await expect(boundedJson(new Response(null), 100)).rejects.toMatchObject({ code: 'json_body_required', status: 400 });
await expect(boundedJson(new Response('x'), 100)).rejects.toMatchObject({ code: 'json_body_invalid' });
await expect(boundedJson(new Response(new Uint8Array([255])), 100)).rejects.toMatchObject({ code: 'json_body_invalid' });
await expect(boundedJson(new Response('12345'), 2)).rejects.toMatchObject({ code: 'json_body_too_large', status: 413 });
});
test('answers with no caching, and a refusal is unavailable unless it says otherwise', () => {
expect(reply({ code: 'safe' }).headers.get('Cache-Control')).toBe('no-store');
expect(reply({ code: 'safe' }, 409).status).toBe(409);
expect(new AccessError('unavailable').status).toBe(503);
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |