PropSchema v0.3.0 PropSchema.Stream

Reads the prop_schema information from the provided module. Then it constructs a series of private functions to include in a test module according to provided field requirements and other considerations declared in the schema.

Link to this section Summary

Functions

Scans the schema and calls generate_incomplete_map/3 for each field as the missing_prop

Creates the quoted fixed_map expression like you would find in the property tests but can be used at your discretion

Creates the quoted fixed_map expression but with the specified missing_prop excluded

Link to this section Functions

Link to this macro generate_all_incomplete_maps(mod, additional_props \\ nil) (macro)

Scans the schema and calls generate_incomplete_map/3 for each field as the missing_prop

Example

  defmodule Test do
    require PropSchema.Stream
    PropSchema.Stream.generate_all_incomplete_maps(PropSchema.ExampleModule, PropSchema.ExampleAdditionalProperties)

    def get_ten(excluded), do: excluded |> incomplete() |> Enum.take(10)
  end
Link to this macro generate_complete_map(mod, additional_props \\ nil) (macro)
generate_complete_map(atom(), atom()) :: Types.ast_expression()

Creates the quoted fixed_map expression like you would find in the property tests but can be used at your discretion.

Example

defmodule Test do
  require PropSchema.Stream
  PropSchema.Stream.generate_complete_map(PropSchema.ExampleModule, PropSchema.ExampleAdditionalProperties)

  def get_ten(), do: Enum.take(complete(), 10)
end
Link to this macro generate_incomplete_map(mod, excluded, additional_props \\ nil) (macro)
generate_incomplete_map(atom(), atom(), atom()) :: Types.ast_expression()

Creates the quoted fixed_map expression but with the specified missing_prop excluded.

Example

defmodule Test do
  require PropSchema.Stream
  PropSchema.Stream.generate_incomplete_map(PropSchema.ExampleModule, :test_int, PropSchema.ExampleAdditionalProperties)

  def get_ten(excluded), do: excluded |> incomplete() |> Enum.take(10)
end