Skip to content

Property test: the deadline never passes the maxWaitMs cap #2

Description

@luantaraschi

tests/core/properties.test.ts has three property-based tests over random event
sequences: no message is ever lost, no turn is emitted while a human holds the
conversation, and the dedupe window never grows past its bound.

There is a fourth property worth stating, and it is the one the library rests on:
a turn's deadline never lands past firstBufferedAt + maxWaitMs, whatever arrives
and in whatever order. It is what stops somebody who never stops typing from never
getting an answer.

Today that is covered by scenario tests in tests/core/typing.test.ts and
tests/core/turn.test.ts, which prove it for the sequences somebody thought to write
down.

Where to start

fast-check is already a dev dependency, and the file has the shape to copy. Generate a
sequence of message, typing and tick events with arbitrary timestamps, fold them
through reduce, and assert on deadline(state, policy) after every step where the
buffer is not empty.

Worth watching for: the property only says anything while something is buffered, and
firstBufferedAt is null when nothing is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions