{"id":15724539,"url":"https://github.com/commercetools/test-data","last_synced_at":"2025-04-09T22:14:47.126Z","repository":{"id":38324153,"uuid":"290221793","full_name":"commercetools/test-data","owner":"commercetools","description":"Modules to generate test data for commercetools APIs","archived":false,"fork":false,"pushed_at":"2025-04-09T19:53:58.000Z","size":24572,"stargazers_count":13,"open_issues_count":20,"forks_count":2,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-09T22:13:04.809Z","etag":null,"topics":["audit-frontend","commercetools-platform","commercetools-scp","javascript","test-data","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/commercetools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T13:24:43.000Z","updated_at":"2025-04-08T12:52:10.000Z","dependencies_parsed_at":"2023-09-29T21:13:58.773Z","dependency_job_id":"e2c74e25-2342-4551-a613-7d1fa4c55c98","html_url":"https://github.com/commercetools/test-data","commit_stats":{"total_commits":656,"total_committers":36,"mean_commits":18.22222222222222,"dds":0.8414634146341463,"last_synced_commit":"dbb519fb81cbc05709fbeafa5a54ccebcc3f7e46"},"previous_names":[],"tags_count":4427,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Ftest-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Ftest-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Ftest-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Ftest-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/test-data/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119292,"owners_count":21050755,"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":["audit-frontend","commercetools-platform","commercetools-scp","javascript","test-data","typescript"],"created_at":"2024-10-03T22:17:03.719Z","updated_at":"2025-04-09T22:14:47.102Z","avatar_url":"https://github.com/commercetools.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003ecommercetools Test Data 🤖\u003c/h2\u003e\n\u003cp align=\"center\"\u003e\n  \u003ci\u003e✨ Monorepository with test data models for commercetools platform entities 🛠\u003c/i\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/commercetools/test-data/releases\"\u003e\u003cimg src=\"https://badgen.net/github/release/commercetools/test-data\" alt=\"Latest release\" /\u003e\u003c/a\u003e \u003ca href=\"https://github.com/commercetools/test-data/blob/master/LICENSE\"\u003e\u003cimg src=\"https://badgen.net/github/license/commercetools/test-data\" alt=\"GitHub license\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis repository contains data models within the commercetools platform ecosystem.\n\n\u003e In time, we will continue to implement and open source test data models. If you are interested or missing a specific data model, feel free to open a feature request or try to contribute to the repository.\n\nModels are defined in the `models/*` workspace and are grouped by domain in different packages.\n\nAll models are built using the `core` package, which contains the necessary methods to implement and work with models. The `core` package is very much agnostic of the commercetools platform domain, so you can potentially use it to build your own models for other domains.\n\nTo know more about how to work and build data models, [check out the documentation of the `core` package](./core).\n\n# Usage\n\nUsing models is pretty straightforward. You import the package and build the model, which returns the data in the requested shape.\n\nFor example, assuming we have an `Author` model from a `stories` package:\n\n```ts\nimport type { TAuthor } from '@commercetools-test-data/stories';\n\nimport { Author } from '@commercetools-test-data/stories';\n\nconst author1 = Author.random().firstName('John').buildGraphql\u003cTAuthor\u003e();\nconst author2 = Author.random().firstName('Rebecca').buildGraphql\u003cTAuthor\u003e();\n```\n\n# Local Development with Linked Packages\n\nWhen developing with multiple repositories, you may need to link packages locally to ensure your application uses the latest local changes without waiting for a package to be published. Below is a general approach to achieve this:\n\n## Steps to Link a Local Package\n\n1. **Clone and Set Up the test-data Repository:**\n\n   - Ensure that the test-data repository you want to link is cloned locally and properly set up.\n     ```bash\n     cd path-to-test-data-repo\n     pnpm install\n     ```\n\n2. **Update the Application's `package.json`:**\n\n   - In your application’s `package.json`, replace the dependency version with the relative path to the local package directory. For example:\n     ```json\n     {\n       \"dependencies\": {\n         \"@example/package-name\": \"\u003cpath-to-test-data-package\u003e\",\n         \"@commercetools-test-data/commons\": \"../../../test-data/models/commons\"\n       }\n     }\n     ```\n\n3. **Install Dependencies:**\n\n   - Run the following commands to ensure your application is using the local version of the package:\n     ```bash\n     cd path-to-application-repo\n     pnpm install\n     ```\n\n4. **Verify the Link:**\n\n   - Ensure that the package is correctly linked by inspecting the `node_modules` directory in your application repository. The package should point to your local build instead of fetching from a remote registry.\n\n5. **Development Workflow:**\n   - During development, make changes in the test-data repository, rebuild the package using `pnpm install` in test-data repository, and re-run your application to see the changes reflect immediately.\n   - Remember to revert the `package.json` changes before committing or pushing to a remote repository unless those changes are intended to be shared.\n\n## Important Notes\n\n- This approach is ideal for local development and testing. It ensures that your application runs with the latest package changes without the need to publish the package.\n- Make sure to revert or manage these changes appropriately when switching between local development and production environments.\n\n# Contribution\n\n## Presets Folder\n\nFor organization \u0026 ownership purposes, Pangolin \u0026 FCT house their presets under their respective folders (e.g. change-history-data, sample-data-fashion, sample-data-b2c-lifestyle). These should not be altered by an external team; however, if modifications occur for any reason, a corresponding team review is mandatory.\n\n## FAQ\n\n#### whose review is mandatory for creating PR?\n\nFor pull requests concerning your team's specific presets, only your team's approval is required. If modifications are made to the models, inviting representatives from other teams for review is mandatory.\n\n#### Can I simply copy/paste existing test model from other repository (eg: mc-frontend) to test-data?\n\nAvoid directly copying and pasting from other repository models, as it may complicate cleanup efforts. While specific sections like generator fields and portions of specs may be copied over as is, be mindful that the overall structure and composition may differ significantly from your current setup.\n\n#### Is there a easy way to know which models are already available?\n\nNo, there is no overarching inventory page at this time that outlines each package with its corresponding models.\nEach package contains the draft \u0026 final models that are grouped/organized by their representations as outlined in the docs.\nTake cartDiscounts#representations for example. If you’d like to review what has been created to date for underlying representations, you can just drill to the main [index](https://github.com/commercetools/test-data/blob/main/models/cart-discount/src/index.ts) of that package.\n\n#### How do I test a new model (e.g, with my MC component spec) when I create?\n\nUnfortunately, that part does become a bit more complex.\nCopy and pasting it into the node_modules folder is one option.\nAnother trick that we typically do is to add the new models locally in a separate file, make the call to it, then address any tweaks necessary.\n\n#### What is the procedure after merging the PR?\n\nFor merged pull requests, there is no set schedule for releasing version packages (VP). To date it has simply depended on the traffic and urgency at that point in time.\nIf you need a version released quickly, you are more than welcome to ping the #test-data-migration channel to see if there are any objections to doing so.\nOnce the VP is released, it is immediately accessible. You have the option to either wait for dependency updates to process (e.g [update all test-data packages to v6.10.0](https://github.com/commercetools/merchant-center-frontend/pull/16069)), or updating them manually.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Ftest-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Ftest-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Ftest-data/lists"}