MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / expectWriteRefused

Function expectWriteRefused

packages/core/sdk/src/platform-view.test.ts:409–424  ·  view source on GitHub ↗
(
  effect: Effect.Effect<A, E | StorageError>,
)

Source from the content-addressed store, hash-verified

407 * without the policy ever having been consulted.
408 */
409const expectWriteRefused = <A, E extends { readonly _tag: string }>(
410 effect: Effect.Effect<A, E | StorageError>,
411) =>
412 // The surfaces under test fail with different unions (StorageFailure,
413 // ConnectionNotFoundError, …). The refusal this pins is always a
414 // StorageError, so the effect is widened for the catch; `orDie` below still
415 // turns every OTHER tag into a test failure, and a write that SUCCEEDS dies
416 // rather than reaching an assertion — so the hole can never pass silently.
417 (effect as Effect.Effect<A, StorageError>).pipe(
418 Effect.flatMap(() => Effect.die("expected the platform view to refuse this write")),
419 Effect.catchTag("StorageError", (error: StorageError) => {
420 expect(error.message).toContain("read-only");
421 return Effect.void;
422 }),
423 Effect.orDie,
424 );
425
426describe("platform view — read-only across every surface", () => {
427 it.effect("refuses org-row writes through policies and oauth", () =>

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected