{"id":48410120,"url":"https://github.com/recursivefunk/empty-promises","last_synced_at":"2026-04-06T05:32:25.558Z","repository":{"id":57224977,"uuid":"48134375","full_name":"recursivefunk/empty-promises","owner":"recursivefunk","description":"Promise mocking utility. Mostly used for testing....mostly.","archived":false,"fork":false,"pushed_at":"2015-12-29T15:07:31.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-28T04:44:23.900Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/recursivefunk.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":"2015-12-16T20:49:08.000Z","updated_at":"2015-12-16T22:56:16.000Z","dependencies_parsed_at":"2022-08-24T11:01:06.993Z","dependency_job_id":null,"html_url":"https://github.com/recursivefunk/empty-promises","commit_stats":null,"previous_names":["jray/empty-promises"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/recursivefunk/empty-promises","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recursivefunk%2Fempty-promises","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recursivefunk%2Fempty-promises/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recursivefunk%2Fempty-promises/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recursivefunk%2Fempty-promises/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recursivefunk","download_url":"https://codeload.github.com/recursivefunk/empty-promises/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recursivefunk%2Fempty-promises/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31461527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-04-06T05:32:24.536Z","updated_at":"2026-04-06T05:32:25.545Z","avatar_url":"https://github.com/recursivefunk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nInstall\n```\nnpm install empty-promises\n```\n\nQuick Guide\n```javascript\nconst emptyPromises = require('empty-promises');\nconst asyncThing = emptyPromises();\n\nasyncThing()\n  .then((foo) =\u003e {\n    t.notOk(foo);\n    t.end();\n  })\n  .catch((e) =\u003e {\n    throw e;\n  });\n\nconst asyncThingWithArgs = emptyPromises(['foo', 'bar']);\n\nasyncThingWithArgs()\n  .spread((foo, bar) =\u003e {\n    t.equal(foo, 'foo');\n    t.equal(bar, 'bar');\n    t.end();\n  })\n  .catch((e) =\u003e {\n    throw e;\n  });\n\nconst err = new Error('oh no!');\nconst asyncThingWithErr = emptyPromises(null, err);\n\nasyncThing()\n  .then(() =\u003e {\n    t.fail('I should have caught an error');\n  })\n  .catch((e) =\u003e {\n    t.equal(e.message, 'oh no!');\n    t.end();\n  });  \n```\n\nPractical Usage\n```javascript\n// in mocks.js\nexports.mockSuccessObj = {\n  doATask: emptyPromises()\n};\nexports.mockFailObj = {\n  doATask: emptyPromises(null, new Error('Task failed!'))\n};\n\n// in test.js\nconst test = require('tape');\nconst mocks = require('./mocks');\n\ntest('it works when it works', (t) =\u003e {\n  const aBusinessObject = aBusinessObjectFactory(mocks.mockSuccessObj);\n  aBusinessObject.doStuffThatInvolvesMock()\n    .then(() =\u003e {\n      t.end('Yay!');\n    })\n    .catch((e) =\u003e {\n      t.fail('I should not be here');\n    });\n});\n\ntest('it fails when it fails', (t) =\u003e {\n  const aBusinessObject = aBusinessObjectFactory(mocks.mockFailObj);\n  aBusinessObject.doStuffThatInvolvesMock()\n    .then(() =\u003e {\n      t.fail('I should not be here');\n    })\n    .catch((e) =\u003e {\n      t.equal(e.message, 'Task failed!');\n      t.end('You have failed and that is a good thing!');\n    });\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecursivefunk%2Fempty-promises","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecursivefunk%2Fempty-promises","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecursivefunk%2Fempty-promises/lists"}