{"id":21277696,"url":"https://github.com/batrdn/mocking-bird","last_synced_at":"2025-07-11T08:32:01.973Z","repository":{"id":225185869,"uuid":"755540134","full_name":"batrdn/mocking-bird","owner":"batrdn","description":"mocking-bird provides a set of simple, yet accurate and context-aware fixture generation tools for schema or database models. Currently mongoose and graphql fixture generation is supported","archived":false,"fork":false,"pushed_at":"2024-03-30T15:01:19.000Z","size":1016,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-16T02:38:58.798Z","etag":null,"topics":["faker","javascript","mock-data","mock-data-generator","mongoose-fixture","nodejs","testing-tools","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/batrdn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-10T14:24:58.000Z","updated_at":"2024-06-15T11:45:49.000Z","dependencies_parsed_at":"2024-03-04T19:11:56.057Z","dependency_job_id":null,"html_url":"https://github.com/batrdn/mocking-bird","commit_stats":null,"previous_names":["batrdn/mocking-bird"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batrdn%2Fmocking-bird","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batrdn%2Fmocking-bird/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batrdn%2Fmocking-bird/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batrdn%2Fmocking-bird/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/batrdn","download_url":"https://codeload.github.com/batrdn/mocking-bird/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225708290,"owners_count":17511635,"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":["faker","javascript","mock-data","mock-data-generator","mongoose-fixture","nodejs","testing-tools","typescript"],"created_at":"2024-11-21T10:06:55.628Z","updated_at":"2024-11-21T10:06:56.205Z","avatar_url":"https://github.com/batrdn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mocking Bird\n\n![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)\n\nTesting with real-world data scenarios is crucial, but creating such data shouldn't be a chore. Therefore, this project\naims to provide a simple and easy, yet accurate and context-aware data generation for your models or\nschemas, so that it makes your testing experience smooth. Whether it is for unit tests, integration tests or stress\ntests, you can use it to easily generate fake data with flexible custom options and constraints.\n\nWhat does it mean to be context-aware? It means that the generated data is not just some random-random value, but it's\ngenerated in a way that it's suitable for the fields and constraints of your model or schema.\n\nFor example, if you have a field\n`workEmail` in your model, the generated data will be a valid email address, and not just a random string.\n\n# Packages\n\nMocking Bird is a package-based repo using [Nx](https://nx.dev/). To see how individual packages work in detail, please refer to the respective READMEs.\n\n- [@mocking-bird/core](./packages/core)\n- [@mocking-bird/mongoose](./packages/mongoose/README.md)\n- [@mocking-bird/graphql](./packages/graphql/README.md)\n\nTo contribute to the project with a new package, please refer to the [contribution guidelines](CONTRIBUTING.md).\n\n# Examples\n\n### Mongoose Fixture\n\n```typescript\nimport { Schema } from 'mongoose';\nimport { MongooseFixture } from '@mocking-bird/mongoose';\n\nconst schema = new Schema({\n  name: String,\n  email: String,\n  age: { type: Number, min: 18, max: 100 },\n  workEmail: String,\n  address: {\n    street: String,\n    city: String,\n    country: String,\n  },\n  createdAt: Date,\n  updatedAt: Date,\n});\n\nconst fixture = new MongooseFixture(schema);\n\nconst data = fixture.generate();\n```\n\n**Example output:**\n\n```json\n{\n  \"name\": \"Turner, Thompson and Mueller\",\n  \"email\": \"Jerome.Mraz58@yahoo.com\",\n  \"age\": 55,\n  \"workEmail\": \"Sabrina99@hotmail.com\",\n  \"address\": {\n    \"street\": \"Apt. 123 1234\",\n    \"city\": \"Lake Ethylburgh\",\n    \"country\": \"Gambia\"\n  },\n  \"createdAt\": \"2023-09-11T05:38:59.576Z\",\n  \"updatedAt\": \"2024-02-26T08:25:16.412Z\",\n  \"_id\": \"a84f58e2fcff9dfaf148d7bf\"\n}\n```\n\n### GraphQL Fixture\n\n```typescript\nimport { GraphQLFixture } from '@mocking-bird/graphql';\nimport { GraphQLSchema } from 'graphql';\n\nconst typeDefs = `\n  type User {\n    name: String\n    email: String\n    age: Int\n    workEmail: String\n    address: Address\n    createdAt: Date\n    updatedAt: Date\n  }\n\n  type Address {\n    street: String\n    city: String\n    country: String\n  }\n`;\n\nGraphQLSchema.registerSchema(typeDefs);\n\n// TypedDocumentNode is a fully typed graphql document node\n// For more information: https://github.com/dotansimha/graphql-typed-document-node\nconst fixture = new GraphQLFixture(TypedDocumentNode);\nconst data = fixture.generate();\n```\n\n# Running tests\n\nDepending on which directory you are in, you can run the tests for the respective package.\n\n`npm run test`\n\nIn the root directory, it will run the tests for only affected packages.\n\nAlternatively, you could directly use `nx` to run the tests.\n\n```\nnpx nx affected -t test --parallel\nnpx nx run-many --target=test --all\n```\n\n# License\n\nThe MIT License (MIT) 2024 - [Bat-Erdene Tsogoo](https://github.com/batrdn). Please have a look at the\n[LICENSE](LICENSE.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatrdn%2Fmocking-bird","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatrdn%2Fmocking-bird","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatrdn%2Fmocking-bird/lists"}