{"id":16844784,"url":"https://github.com/stephanhoyer/spy-then","last_synced_at":"2025-03-18T06:23:17.646Z","repository":{"id":57368122,"uuid":"59960589","full_name":"StephanHoyer/spy-then","owner":"StephanHoyer","description":"Simple async spy helper","archived":false,"fork":false,"pushed_at":"2023-12-15T05:49:52.000Z","size":8,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T22:24:43.203Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/StephanHoyer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-29T19:39:19.000Z","updated_at":"2020-07-30T12:35:09.000Z","dependencies_parsed_at":"2024-10-13T12:56:38.344Z","dependency_job_id":"f58f1272-da8d-4d29-ae7c-6efde48bf7f3","html_url":"https://github.com/StephanHoyer/spy-then","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/StephanHoyer%2Fspy-then","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fspy-then/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fspy-then/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanHoyer%2Fspy-then/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StephanHoyer","download_url":"https://codeload.github.com/StephanHoyer/spy-then/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244167369,"owners_count":20409306,"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-13T12:56:37.051Z","updated_at":"2025-03-18T06:23:17.625Z","avatar_url":"https://github.com/StephanHoyer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/StephanHoyer/spy-then.svg)](https://travis-ci.org/StephanHoyer/spy-then)\n[![rethink.js](https://img.shields.io/badge/rethink-js-yellow.svg)](https://github.com/rethinkjs/manifest)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![Dependency Status](https://david-dm.org/StephanHoyer/sock-channels.svg)](https://david-dm.org/StephanHoyer/sock-channels)\n\n# spy-then\nSimple async spy helper\n\n## Usage\n\n```javascript\nvar spyThen = require('spy-then')(optionalOptions)\n\nvar makeSpy = spyThen(function() {\n  console.log('ready')\n}, optionalOptions)\n\nspyA = makeSpy('foo')\nspyB = makeSpy('bar')\n\nspyB('foo') // -\u003e nothing happens\nspyB('bar') // -\u003e console.log('ready') will be called\n```\n\n## Options\n\nYou can either initialize the library with options or you can give them to each\nspy-maker individually.\n\nPossible options are\n\n* `options.argCheck`: should be a function that gets two arguments, first one is\n  the expected argument, second one is the actual. You can feed those to your\n  assertions library\n* `options.allowMultipleCalls`: should be true, if multiple calls of a spy are\n  allowed\n\n## Todo/Ideas\n\n### Expect callCount\n\n```javascript\nspyA = makeSpy({\n  args: ['argOffirstCall', 'arfOfSecondCall'],\n  minCallCount: 2,\n  maxCallCount: 4\n})\n```\n\n## more options\n\n* `minCallCount`\n* `maxCallCount`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fspy-then","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephanhoyer%2Fspy-then","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanhoyer%2Fspy-then/lists"}