Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Params CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: Run tests
runs-on: ubuntu-22.04
env:
MIX_ENV: test

strategy:
matrix:
otp: ['25.x', '26.x']
elixir: ['1.14', '1.15']

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Install Dependencies
run: mix deps.get
- name: Run tests
run: mix test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Looking for maintainer](https://github.com/vic/params/issues/new?title=Becoming%20a%20maintainer)

[![Build Status](https://travis-ci.org/vic/params.svg?branch=master)](https://travis-ci.org/vic/params)
[![Build Status](https://github.com/vic/params/actions/workflows/ci.yaml/badge.svg)](https://github.com/vic/params/actions)
[![Hex Version](https://img.shields.io/hexpm/v/params.svg)](https://hex.pm/packages/params)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/params/)
[![Total Download](https://img.shields.io/hexpm/dt/params.svg)](https://hex.pm/packages/params)
Expand Down
5 changes: 3 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
%{
"decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm", "130926580655f34d759dd25f5d723fd233c9bbe0399cde57e2a1adea9ed92e08"},
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"dialyxir": {:hex, :dialyxir, "0.5.0", "5bc543f9c28ecd51b99cc1a685a3c2a1a93216990347f259406a910cf048d1d7", [:mix], [], "hexpm", "7c5c6c1eceb93e26a06c36148cb6f8021ae6f4f9a07bb1ae95f588e0a01ea8e1"},
"earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm", "000aaeff08919e95e7aea13e4af7b2b9734577b3e6a7c50ee31ee88cab6ec4fb"},
"earmark_parser": {:hex, :earmark_parser, "1.4.18", "e1b2be73eb08a49fb032a0208bf647380682374a725dfb5b9e510def8397f6f2", [:mix], [], "hexpm", "114a0e85ec3cf9e04b811009e73c206394ffecfcc313e0b346de0d557774ee97"},
"ecto": {:hex, :ecto, "3.0.1", "a26605ee7b243a754e6609d1c23da27bcb22823659b07bf03f9020da92a8e4f4", [:mix], [{:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "8a04eb11fd4a1e75443fe5f7e4ea38f77c36b7325ea478a5e7a301f52b236504"},
"ecto": {:hex, :ecto, "3.10.3", "eb2ae2eecd210b4eb8bece1217b297ad4ff824b4384c0e3fdd28aaf96edd6135", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "44bec74e2364d491d70f7e42cd0d690922659d329f6465e89feb8a34e8cd3433"},
"ex_doc": {:hex, :ex_doc, "0.26.0", "1922164bac0b18b02f84d6f69cab1b93bc3e870e2ad18d5dacb50a9e06b542a3", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2775d66e494a9a48355db7867478ffd997864c61c65a47d31c4949459281c78d"},
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
"makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
}
12 changes: 6 additions & 6 deletions test/params_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule ParamsTest do
end

test "defaults to all optional fields" do
assert [:_id, :age, :name] == Params.optional PetParams
assert [:_id, :age, :name] == Enum.sort(Params.optional(PetParams))
end

test "from returns a changeset" do
Expand Down Expand Up @@ -112,11 +112,11 @@ defmodule ParamsTest do
}

test "kitten module has list of required fields" do
assert [:near_location, :breed] = Params.required(Params.ParamsTest.Kitten)
assert [:breed, :near_location] = Enum.sort(Params.required(Params.ParamsTest.Kitten))
end

test "kitten module has list of optional fields" do
assert [:age_min, :age_max] = Params.optional(Params.ParamsTest.Kitten)
assert [:age_max, :age_min] = Enum.sort(Params.optional(Params.ParamsTest.Kitten))
end

test "kitten method returns changeset" do
Expand Down Expand Up @@ -148,7 +148,7 @@ defmodule ParamsTest do
end

test "puppy module has list of optional fields" do
assert [:age_min, :age_max] = Params.optional(Params.ParamsTest.Puppy)
assert [:age_max, :age_min] = Enum.sort(Params.optional(Params.ParamsTest.Puppy))
end

test "puppy method returns changeset" do
Expand Down Expand Up @@ -176,11 +176,11 @@ defmodule ParamsTest do
}

test "dragon module has list of required fields" do
assert [:near_locations, :breed] = Params.required(Params.ParamsTest.Dragon)
assert [:breed, :near_locations] = Enum.sort(Params.required(Params.ParamsTest.Dragon))
end

test "dragon module has list of optional fields" do
assert [:age_min, :age_max] = Params.optional(Params.ParamsTest.Dragon)
assert [:age_max, :age_min] = Enum.sort(Params.optional(Params.ParamsTest.Dragon))
end

test "dragon method returns changeset" do
Expand Down