Created
September 26, 2017 07:48
-
-
Save frekw/a7ddf0a2e1cc7fb8ae8bc51426563700 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def comment do | |
gen all id <- positive_integer(), | |
author <- string(:alphanumeric, max_length: 64), | |
body <- string(:alphanumeric) do | |
%{id: id, | |
author: author, | |
body: body} | |
end | |
end | |
def stats(comments) do | |
# how do generate this properties based on | |
# data in "comments" properly? | |
ids = map(comments, &(&1.id)) | |
gen all deleted <- positive_integer(), | |
in_review <- list_of(ids), | |
flagged <- list_of(ids) do | |
%{deleted: deleted, | |
in_review: in_review, | |
flagged: flagged} | |
end | |
end | |
def post do | |
gen all body <- string(:alphanumeric) | |
author <- string(:alphanumeric, max_length: 64) | |
comments <- list_of(comment()) | |
stats <- stats(comments) do | |
%{author: author, | |
body: body, | |
comments: comments, | |
stats: stats} | |
end | |
end | |
Add Comment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment