dogmatiq / dogmatiq/testkit

Allow the "recorded at" time to be asserted for events.

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
1
Forks
1
Avg merge
2m
Merged PRs (30d)
1

Description

It may be useful to be able to assert the time at which a specific event has been recorded, specifically when the event is expected to be fired at some specific time as part of a process that uses timeout messages.

Perhaps we could do this by adding "functional options" to the ToRecordEvent[Type]() functions, something like the following:

test.Expect(
    AdvanceTime(ByDuration(24 * time.Hour)),
    ToRecordEvent(
        MyCoolEvent{ ... },
        RecordedAt(someTime),
    ),
)

We'd need to think carefully about whether the option types passed to ToRecordEvent() should be the same type as those passed to ToRecordEventType() or not, and if not, design the an option interface so that options like RecordedAt() can be passed to both assertions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ToRecordEvent and ToRecordEventType assertion APIs mentioned in the issue, along with how AdvanceTime and timeout messages are handled. Define the option design for RecordedAt and verify that both event assertions can check an expected recorded time; done means tests can assert a specific event timestamp.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.