PropSchema.Stream (PropSchema v1.1.0) View Source
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/4 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
generate_all_incomplete_maps(mod, name, additional_props \\ nil)
View Source (macro)Specs
Scans the schema and calls generate_incomplete_map/4 for each field as the missing_prop
Example
defmodule Test do
require PropSchema.Stream
PropSchema.Stream.generate_all_incomplete_maps(PropSchema.ExampleModule, :incomplete_example_module, PropSchema.ExampleAdditionalProperties)
def get_ten(excluded), do: excluded |> incomplete_example_module() |> Enum.take(10)
end
Specs
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, :complete_example_module, PropSchema.ExampleAdditionalProperties)
def get_ten(), do: Enum.take(complete_example_module(), 10)
end
generate_incomplete_map(mod, name, excluded, additional_props \\ nil)
View Source (macro)Specs
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, :incomplete_example_module, :test_int, PropSchema.ExampleAdditionalProperties)
def get_ten(excluded), do: excluded |> incomplete_example_module() |> Enum.take(10)
end