Skip to content

Allow projectors to be tested directly #26

@slashdotdash

Description

@slashdotdash

Make it possible to test a projector by directly calling a function on the projector module, passing an Ecto.Multi struct, an event, and its metadata.

Examples

Test a projector by projecting a single event:

{:ok, _changes} =
  Ecto.Multi.new()
  |> MyApp.ExampleProjector.project(event, metadata)
  |> MyApp.Repo.transaction()

Test a projector by reducing a list of events:

multi = 
  Enum.reduce(events, Ecto.Multi.new(), fn event, multi ->
    MyApp.ExampleProjector.project(multi, event, metadata)
  end)

{:ok, _changes} = MyApp.Repo.transaction(multi)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions