{"id":18186039,"url":"https://github.com/cpg1111/factorydude","last_synced_at":"2026-05-16T18:08:23.062Z","repository":{"id":25891146,"uuid":"29331635","full_name":"cpg1111/FactoryDude","owner":"cpg1111","description":"A Node module to create mongoose objects for test data","archived":false,"fork":false,"pushed_at":"2015-06-03T14:07:19.000Z","size":259,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-10T09:32:59.537Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpg1111.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-01-16T03:53:37.000Z","updated_at":"2015-12-07T16:51:59.000Z","dependencies_parsed_at":"2022-08-24T14:16:20.918Z","dependency_job_id":null,"html_url":"https://github.com/cpg1111/FactoryDude","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cpg1111/FactoryDude","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg1111%2FFactoryDude","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg1111%2FFactoryDude/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg1111%2FFactoryDude/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg1111%2FFactoryDude/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpg1111","download_url":"https://codeload.github.com/cpg1111/FactoryDude/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg1111%2FFactoryDude/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267332002,"owners_count":24070308,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"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":"2024-11-02T23:04:33.653Z","updated_at":"2026-05-16T18:08:23.008Z","avatar_url":"https://github.com/cpg1111.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FactoryDude\n\nA Node module to create mongoose objects for test data\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cpg1111/FactoryDude?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\u003cimg src=\"https://travis-ci.org/cpg1111/FactoryDude.svg?branch=master\" style=\"float: left;\"/\u003e\n\u003cimg src=\"https://david-dm.org/cpg1111/FactoryDude.svg\" style=\"float: left;\"/\u003e\n\u003ca href=\"http://badge.fury.io/gh/cpg1111%2FFactoryDude\"\u003e\u003cimg src=\"https://badge.fury.io/gh/cpg1111%2FFactoryDude.svg\" style=\"float: left;\" alt=\"GitHub version\" height=\"18\"\u003e\u003c/a\u003e\n\u003ca href=\"http://badge.fury.io/js/factorydude\"\u003e\u003cimg src=\"https://badge.fury.io/js/factorydude.svg\" alt=\"npm version\" height=\"18\" style=\"float: left;\"\u003e\u003c/a\u003e\n\nTo be used in test suites (\u003ca href=\"https://github.com/mochajs/mocha\"\u003emocha\u003c/a\u003e, \u003ca href=\"https://github.com/chaijs/chai\"\u003echai\u003c/a\u003e, \u003ca href=\"https://github.com/jasmine/jasmine\"\u003ejasmine\u003c/a\u003e, etc) for features that use \u003ca href=\"https://github.com/LearnBoost/mongoose\"\u003emongoose\u003c/a\u003e models.\nInspired by \u003ca href=\"https://github.com/thoughtbot/factory_girl\"\u003efactory_girl\u003c/a\u003e\n\n### Install\n\n```\n\tnpm  install FactoryDude\n```\n\n## Usage\n\n```\n\tvar FactoryDude = require('FactoryDude');\n\tvar factoryDude = new FactoryDude();\n```\n\n### Create a Factory\n\n```\n\tvar newFixtureModel = factoryDude.factory(\n\t\t\u003cmodel name\u003e,\n\t\t\u003cpath to require model\u003e,\n\t\t\u003cobject with model attributes to create\u003e\n\t);\n\t/*\n\t * returns a mongoose model that has been saved in the database\n\t * and can be used just as any other mongoose models.\n\t */\n```\n\n### Reference one factory in another factory\n```\n\tfactoryDude.reference(\u003cname of model to reference\u003e, \u003cattribute to reference\u003e);\n```\n\n```\n\tvar firstFixtureModel = factoryDude.factory(\n\t\t'firstModel',\n\t\t'./path/to/model',\n\t\t{name: 'test', number: 1}\n\t);\n\t//creates a model with the name test and a number 1\n\n\tvar secondFixtureModel = factoryDude.factory(\n\t\t'secondModel',\n\t\t'./path/to/model',\n\t\t{name: factoryDude.reference('firstModel', 'name'), number: 2}\n\t);\n\t//creates a model with the name test and a number 2\n```\n\n### Destroy a factory model that was already created\n```\n\tfactoryDude.destroy(\u003cname of model\u003e);\n```\n\n```\n\tvar firstFixtureModel = factoryDude.factory(\n\t\t'firstModel',\n\t\t'./path/to/model',\n\t\t{name: 'test', number: 1}\n\t);\n\n\tfactoryDude.destroy('firstModel'); //'firstModel' is no longer in the database or a fixture\n```\n\n## License\nFactoryDude is licensed under the apache license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg1111%2Ffactorydude","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpg1111%2Ffactorydude","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg1111%2Ffactorydude/lists"}