Skip to content

Commit 740b5ce

Browse files
committed
test(runtime): the dispatcher serves no item DELETE; compare its layered read with its PUT
Claude-Session: https://claude.ai/code/session_01FEkQ5o95tvF7A7y85W37iR Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8cc4d7a commit 740b5ce

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎packages/runtime/src/domains/meta-layers-ambiguous-package.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ async function bootStore() {
8787

8888
interface Answer { status: number; body: any }
8989
interface Door {
90+
/** Whether this transport serves `DELETE /meta/:type/:name` at all (the dispatcher answers `405`). */
91+
readonly deletes: boolean;
9092
send(method: 'GET' | 'PUT' | 'DELETE', path: string, query?: Record<string, string>, item?: unknown): Promise<Answer>;
9193
boundTo(name: string): Promise<Array<string | null>>;
9294
}
@@ -111,6 +113,7 @@ async function bootRestServer(): Promise<Door> {
111113
rest.resolveExecCtx = async () => clone(AUTHOR);
112114
rest.registerRoutes();
113115
return {
116+
deletes: true,
114117
boundTo,
115118
send: async (method, path, query = {}, item) => {
116119
const s = path.replace(/^\/meta\//, '').split('/');
@@ -147,6 +150,7 @@ async function bootCatchAll(): Promise<Door> {
147150
const dispatcher = new HttpDispatcher(kernel);
148151
(dispatcher as any).timedResolveExecutionContext = async () => clone(AUTHOR);
149152
return {
153+
deletes: false,
150154
boundTo,
151155
send: async (method, path, query = {}, item) => {
152156
const url = new URL(`http://localhost${PREFIX}${path}`);
@@ -187,12 +191,14 @@ const SPELLINGS: ReadonlyArray<readonly [string, (name: string) => [string, Reco
187191

188192
for (const [doorName, boot] of DOORS) {
189193
describe(`[#28337] ${doorName}: the layered view of a name two packages hold`, () => {
190-
it('naming no package, both spellings answer the package-less save\'s and delete\'s own 409', async () => {
194+
it('naming no package, both spellings answer the package-less writes\' own 409', async () => {
191195
const door = await boot();
192196
const save = await door.send('PUT', '/meta/dashboard/twin_dash', {}, dashboard('twin_dash', 'edited'));
193-
const remove = await door.send('DELETE', '/meta/dashboard/twin_dash');
194197
expect([save.status, codeOf(save.body)], JSON.stringify(save.body)).toEqual([409, 'RESOURCE_CONFLICT']);
195-
expect([remove.status, codeOf(remove.body)], JSON.stringify(remove.body)).toEqual([409, 'RESOURCE_CONFLICT']);
198+
if (door.deletes) {
199+
const remove = await door.send('DELETE', '/meta/dashboard/twin_dash');
200+
expect([remove.status, codeOf(remove.body)], JSON.stringify(remove.body)).toEqual([409, 'RESOURCE_CONFLICT']);
201+
}
196202
for (const [spelling, at] of SPELLINGS) {
197203
const [path, query] = at('twin_dash');
198204
const read = await door.send('GET', path, query);

0 commit comments

Comments
 (0)