Scenario.write
function · packages/remote/src/scenario.ts:643
write<Principal>(scenario: WriteScenario<Principal>): WriteScenario<Principal>A write scenario; the types are the declaration.
Remote / foldkit-remote/testing
namespace · packages/remote/src/scenario.ts:641
const Scenario = {
write,
accepted,
refused,
forbidden,
unauthenticated,
remote,
run,
fromReport,
messages,
reads,
breaks,
runMessages,
decisionOf,
expectedDecision,
expectedRow,
target,
pick,
mismatches,
describeMismatch,
}Scenario.writefunction · packages/remote/src/scenario.ts:643
write<Principal>(scenario: WriteScenario<Principal>): WriteScenario<Principal>A write scenario; the types are the declaration.
Scenario.acceptedfunction · packages/remote/src/scenario.ts:645
accepted(row: Row): WriteExpectationThe write lands; row holds the fields it changes.
Scenario.refusedfunction · packages/remote/src/scenario.ts:647
refused(refusal: RefusalMatch): WriteExpectationRefused by an invariant (or a write's ensures), or by 'Unmet', 'Conflict', 'Taken', 'Referenced'.
Scenario.forbiddenconst · packages/remote/src/scenario.ts:648
forbidden: WriteExpectationScenario.unauthenticatedconst · packages/remote/src/scenario.ts:649
unauthenticated: WriteExpectationScenario.remotefunction · packages/remote/src/scenario.ts:234
remote<AppModel, Principal>(
options: RemoteRunnerOptions<AppModel, Principal>,
): ScenarioRunner<Principal>Runs a scenario through Law.check, so the client's prediction and the
server's answer are compared in the same run, and through the server alone
for the decision and the row it leaves. Steps: law (the client and the
server agree), decision, and row, which a Forbidden or an
Unauthenticated scenario has none of, since nobody it names may read it.
operation is sent with the write, but Law.check does not take one: a
runner that asserts a ledger is an example's.
Scenario.runfunction · packages/remote/src/scenario.ts:392
run<Principal>(
scenario: WriteScenario<Principal>,
runners: ReadonlyArray<ScenarioRunner<Principal>>,
options?: {
readonly report?: LawsReport | undefined
},
): Effect.Effect<ScenarioResult, unknown, never>Runs scenario on every runner, compares what each said with what the
scenario expects, and issues one Scenario record per runner that had no
mismatch, for each invariant the write could break (given report).
With report, a scenario that expects what enumeration disproved throws
here, before any runner runs. The runners run in order.
Scenario.fromReportfunction · packages/remote/src/scenario.ts:456
fromReport<Principal>(
report: LawsReport,
options: FromReportOptions<Principal>,
): ReadonlyArray<WriteScenario<Principal>>The scenarios a report implies: an acceptance for each arrow it says holds,
a rejection for each refused pair. Each runs the reference judge's answer
against the application's own stack. A pair a write only states by its
author's word (Declared), an undecided one and an undeclared arrow
imply none, since the report decided nothing there.
Scenario.messagesfunction · packages/remote/src/scenario.ts:654
messages<Message>(
scenario: MessageScenario<Message>,
): MessageScenario<Message>A Message scenario.
Scenario.readsfunction · packages/remote/src/scenario.ts:655
reads(reader: string, equals: unknown): MessageExpectationScenario.breaksfunction · packages/remote/src/scenario.ts:660
breaks(law: string): MessageExpectationScenario.runMessagesfunction · packages/remote/src/scenario.ts:595
runMessages<Model, Message>(
scenario: MessageScenario<Message>,
options: MessageRunOptions<Model, Message>,
): ScenarioResultApplies the history and when over the Model, and judges expect.
Scenario.decisionOffunction · packages/remote/src/scenario.ts:185
decisionOf<
E extends {
readonly _tag: string
},
R,
>(
mutation: AnyMutation,
call: Effect.Effect<unknown, E, R>,
): Effect.Effect<Decision, never, R>For a runner of another package: the decision a failed call reads as, and the scenario's own sides.
Scenario.expectedDecisionfunction · packages/remote/src/scenario.ts:114
expectedDecision({ expect }: { readonly expect: WriteExpectation }): DecisionScenario.expectedRowfunction · packages/remote/src/scenario.ts:142
expectedRow(scenario: WriteScenario<unknown>): RowThe fields the scenario says the row holds afterwards: what the write changes, or the seeded ones.
Scenario.targetfunction · packages/remote/src/scenario.ts:123
target({ when: [mutation, input] }: WriteScenario<unknown>): stringThe id of the row the write is aimed at, read from its encoded input.
Scenario.pickfunction · packages/remote/src/scenario.ts:151
pick(row: Row, of: Row): RowThe fields of row that of names.
Scenario.mismatchesfunction · packages/remote/src/scenario.ts:197
mismatches(steps: ReadonlyArray<ScenarioStep>): ReadonlyArray<ScenarioStep>Scenario.describeMismatchfunction · packages/remote/src/scenario.ts:201
describeMismatch({ backend, step, expected, actual }: ScenarioStep): stringA mismatch as a line: which backend, which step, and both sides.