{"id":19090737,"url":"https://github.com/kodedninja/fek","last_synced_at":"2025-04-30T10:23:12.065Z","repository":{"id":63254432,"uuid":"173588783","full_name":"kodedninja/fek","owner":"kodedninja","description":"One ridiculously simple function to fake and spy","archived":false,"fork":false,"pushed_at":"2019-03-03T18:38:15.000Z","size":3,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T10:23:02.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodedninja.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-03T14:54:44.000Z","updated_at":"2024-01-12T19:47:52.000Z","dependencies_parsed_at":"2022-11-15T21:45:23.851Z","dependency_job_id":null,"html_url":"https://github.com/kodedninja/fek","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Ffek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Ffek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Ffek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Ffek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodedninja","download_url":"https://codeload.github.com/kodedninja/fek/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251683858,"owners_count":21627034,"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-11-09T03:08:52.327Z","updated_at":"2025-04-30T10:23:12.039Z","avatar_url":"https://github.com/kodedninja.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fek\nOne ridiculously simple function to fake and spy.\n\n## Installation\n```\nnpm i fek\n```\n\n## Usage\n\n```javascript\nvar test = require('tape')\nvar fake = require('fek')\n\ntest('spy', function (t) {\n  t.plan(4)\n  // spy\n  var f = fake(function (x) {\n    return x * 2\n  })\n\n  f(2)\n\n  t.equal(f.callCount(), 1, 'it was called once')\n  t.deepEqual(f.lastArgs(), [2], 'with 2 as argument')\n  t.equal(f.lastCall().returned, 4, 'returned 4')\n\n  // or fake\n  var f = fake()\n\n  f()\n\n  t.equal(f.callCount(), 1, 'it was called once')\n})\n```\n\n## API\n#### `spy = fake(fn)`\nWraps `fn` in a spy. If there's no `fn` it fakes a function.\n\n#### `spy.calls()`\nReturns an array of calls with the following properties:\n- `args`: an array of arguments\n- `returned`: the value that was returned by `fn`\n\n#### `spy.callCount()`\nReturns the number of times the function was called.\n\n#### `spy.lastCall()`\nReturns the call object of the last call.\n\n#### `spy.lastArgs()`\nReturns the arguments of the last call.\n\n#### `spy.reset()`\nResets all spy values.\n\n## See Also\n- [jupiter/simple-mock](https://github.com/jupiter/simple-mock)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Ffek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodedninja%2Ffek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Ffek/lists"}