Close endpoint failure types across service and web boundaries

This commit is contained in:
ms2k 2026-07-20 21:34:25 +09:00
commit 390434bed1

View file

@ -132,6 +132,43 @@ test('shared fixtures decode through every JSON transport method', async () => {
);
});
test('delete batch decoding enforces the typed item outcome', async () => {
const failureClient = new BrowserProductClient(async () =>
jsonResponse({
results: [
{
path: 'folder/file.txt',
operation_id: 'operation-1',
result: null,
error: 'database_unavailable'
}
]
})
);
const failure = requireValue(
await failureClient.deleteBatch({ body: fixtures.delete_batch_request })
);
assert.equal(failure.results[0].error, 'database_unavailable');
const invalidClient = new BrowserProductClient(async () =>
jsonResponse({
results: [
{
path: 'folder/file.txt',
operation_id: 'operation-1',
result: 'succeeded',
error: 'object_store_unavailable'
}
]
})
);
const invalid = await invalidClient.deleteBatch({
body: fixtures.delete_batch_request
});
assert.equal(invalid.ok, false);
assert.equal(invalid.failure.kind, 'unexpected-http');
});
test('declared, undeclared, and network failures remain distinct without retries', async () => {
const declaredClient = new BrowserProductClient(async () =>
jsonResponse(