{"id":19216565,"url":"https://github.com/fbeline/copeiro","last_synced_at":"2026-02-27T19:18:32.937Z","repository":{"id":52178823,"uuid":"359982048","full_name":"fbeline/copeiro","owner":"fbeline","description":"The Copeiro package provides assertion functions that will enhance your testing experience","archived":false,"fork":false,"pushed_at":"2021-05-09T21:24:43.000Z","size":40,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T01:49:42.466Z","etag":null,"topics":["elixir","elixir-lang","testing","testing-library"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fbeline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-20T23:59:58.000Z","updated_at":"2023-02-23T13:13:51.000Z","dependencies_parsed_at":"2022-08-29T04:42:22.122Z","dependency_job_id":null,"html_url":"https://github.com/fbeline/copeiro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeline%2Fcopeiro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeline%2Fcopeiro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeline%2Fcopeiro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbeline%2Fcopeiro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fbeline","download_url":"https://codeload.github.com/fbeline/copeiro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253839741,"owners_count":21972363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","elixir-lang","testing","testing-library"],"created_at":"2024-11-09T14:17:39.388Z","updated_at":"2025-10-04T13:34:49.513Z","avatar_url":"https://github.com/fbeline.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Copeiro [![Elixir CI](https://github.com/fbeline/copeiro/actions/workflows/elixir.yml/badge.svg?branch=master)](https://github.com/fbeline/copeiro/actions/workflows/elixir.yml)\n\n\u003cimg align=\"left\" height=\"300\" src=\"https://user-images.githubusercontent.com/5730881/116327729-cf9fea00-a79d-11eb-9be4-d4fa5ece38ae.jpg\"\u003e\n\n## Motivation\n\nVery often we need to iterate and transform results while writing tests and asserting lists. This data manipulation inside test statements becomes a repetitive task as the project grows, demanding extra efforts and sometimes producing bloated tests.\n\nThe Copeiro main goal is to extend the ExUnit with an idiomatic DSL that seamless integrates to it, providing a simple way to assert lists of any type.\n\n```elixir\nassert_lists [{:c, 3}, {:a, 1}] in [{:c, 3}, {:b, 2}, {:a, 1}]\n```\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:copeiro, \"~\u003e 0.1.1\", only: :test}\n  ]\nend\n```\n\n## Usage\n\nUsing Copeiro in a test file\n\n```elixir\ndef HelloWorldTest do\n  use ExUnit.Case, async: true\n\n  import Copeiro\n  # ...\nend\n```\n\nAdding Copeiro to your [CaseTemplate](https://hexdocs.pm/ex_unit/ExUnit.CaseTemplate.html) _(recommended)_\n\n```elixir\ndefmodule MyCase do\n  use ExUnit.CaseTemplate\n\n  using do\n    quote do\n      # This code is injected into every case that calls \"use MyCase\"\n      import Copeiro\n    end\n  end\nend\n```\n\n## Examples\n\n  For the following examples `LEFT` and `RIGHT` will be used to describe the expression:\n  \n  `assert_lists LEFT OPERATOR RIGHT`\n\n### All elements of `LEFT` are also elements of `RIGHT`\n\n  ```elixir\n  iex\u003e assert_lists [1, 2] in [0, 2, 1, 3]\n  true\n\n  iex\u003e assert_lists [{:b, 2}, {:a, 1}] in [{:a, 1}, {:b, 2}, {:c, 3}]\n  true\n  ```\n\n### `LEFT` and `RIGHT` has no element in common\n\n  ```elixir\n  iex\u003e assert_lists [1, 2] not in [3, 4]\n  true\n\n  iex\u003e assert_lists [%{c: 3}, %{d: 4}] not in [%{a: 1}, %{b: 2}]\n  true\n  ```\n\n### Asserts that two lists match in any order\n\n  ```elixir\n  iex\u003e assert_lists [1, 2, 3] == [2, 1, 3], any_order: true\n  true\n\n  iex\u003e assert_lists [{:a, 0}, {:b, 1}, {:c, 3}] == [{:a, 0}, {:c, 3}, {:b, 1}], any_order: true\n  true\n  ```\n\n### Asserting lists of maps/structs\n\n  When asserting maps and or structs you can compose the expression with `keys`\n\n  ```elixir\n  iex\u003e assert_lists [%{a: 1}, %{a: 2}] in [%{a: 1, b: 1}, %{a: 2, b: 2}, %{a: 3, b: 3}], keys: [:a]\n  true\n\n  iex\u003e assert_lists [%Person{name: \"john\", age: 20}] == [%Person{name: \"Jane\", age: 20}], keys: [:age]\n  true\n  ```\n\n## Helpful error messages\n\n  ```\n  assert_lists [%{d: 4}, %{a: 1}] not in [%{a: 1}, %{b: 2}]\n\n     match succeeded, but should have failed\n     value: %{a: 1}\n     left: [%{d: 4}, %{a: 1}]\n     right: [%{a: 1}, %{b: 2}]\n  ```\n\n## License\n\nMIT License\n\nCopyright (c) 2021 Felipe Beline Baravieira\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbeline%2Fcopeiro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffbeline%2Fcopeiro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbeline%2Fcopeiro/lists"}