{"id":17130701,"url":"https://github.com/jechol/mok","last_synced_at":"2025-06-18T21:43:56.507Z","repository":{"id":39874377,"uuid":"462643548","full_name":"jechol/mok","owner":"jechol","description":"Function mock generator for Elixir","archived":false,"fork":false,"pushed_at":"2024-05-02T16:53:01.000Z","size":333,"stargazers_count":8,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T05:58:39.040Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jechol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-23T08:22:14.000Z","updated_at":"2023-12-18T04:37:40.000Z","dependencies_parsed_at":"2023-01-23T02:31:06.680Z","dependency_job_id":"65f00e17-8b1f-416f-8e36-cf954cbfde9d","html_url":"https://github.com/jechol/mok","commit_stats":{"total_commits":333,"total_committers":7,"mean_commits":47.57142857142857,"dds":"0.29729729729729726","last_synced_commit":"20c6721026a82b40b29ecee83b96012594e8da20"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jechol/mok","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Fmok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Fmok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Fmok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Fmok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jechol","download_url":"https://codeload.github.com/jechol/mok/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Fmok/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260453810,"owners_count":23011584,"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":[],"created_at":"2024-10-14T19:13:00.427Z","updated_at":"2025-06-18T21:43:51.493Z","avatar_url":"https://github.com/jechol.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![mix test](https://github.com/jechol/mok/workflows/mix%20test/badge.svg)](https://github.com/jechol/mok/actions)\n[![Hex version badge](https://img.shields.io/hexpm/v/mok.svg)](https://hex.pm/packages/mok)\n[![License badge](https://img.shields.io/hexpm/l/mok.svg)](https://github.com/jechol/mok/blob/main/LICENSE.md)\n\n`mok` is small library to inject and mock functions easily.\n\n## Installation\n\nThe package can be installed by adding `mok` to your list of dependencies\nin `mix.exs`:\n\n```elixir\ndef deps do\n  [{:mok, \"~\u003e 0.1\"}]\nend\n```\n\n## Usage\n\n#### `inject`, `mock`\n\n```elixir\n\n  defmodule Target do\n    require Mok\n\n    def call(mocks) do\n      a = [1, 2, 3] |\u003e List.first() |\u003e Mok.inject(mocks, \"unmatched\") # 1 (not injected)\n      b = [1, 2, 3] |\u003e List.first() |\u003e Mok.inject(mocks, \"matched\") # 10 (injected)\n      c = [1, 2, 3] |\u003e List.first() |\u003e Mok.inject(mocks, nil) # 1 (not injected)\n      d = [1, 2, 3] |\u003e List.first() |\u003e Mok.inject(mocks) # 100 (injected)\n\n      a + b + c + d\n    end\n  end\n```\n\n```elixir\nrequire Mok\n\nassert 4 == Target.call(%{})\n\nassert 112 ==\n          Target.call(\n            Mok.mock(%{\n              {\u0026List.first/1, \"matched\"} =\u003e 10,\n              \u0026List.first/1 =\u003e 100\n            })\n          )\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjechol%2Fmok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjechol%2Fmok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjechol%2Fmok/lists"}