{"id":15937972,"url":"https://github.com/qawatake/fixify","last_synced_at":"2025-04-03T20:14:35.119Z","repository":{"id":250021347,"uuid":"832440194","full_name":"qawatake/fixify","owner":"qawatake","description":"A Go library for writing test fixtures in a declarative way","archived":false,"fork":false,"pushed_at":"2024-07-25T12:40:14.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T08:18:43.383Z","etag":null,"topics":["fixture","fixtures","go","golang","testing"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/qawatake/fixify","language":"Go","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/qawatake.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":"2024-07-23T03:17:39.000Z","updated_at":"2024-07-25T12:40:19.000Z","dependencies_parsed_at":"2024-10-29T12:51:27.604Z","dependency_job_id":null,"html_url":"https://github.com/qawatake/fixify","commit_stats":null,"previous_names":["qawatake/fixify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Ffixify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Ffixify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Ffixify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Ffixify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qawatake","download_url":"https://codeload.github.com/qawatake/fixify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070928,"owners_count":20878586,"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":["fixture","fixtures","go","golang","testing"],"created_at":"2024-10-07T05:20:28.383Z","updated_at":"2025-04-03T20:14:35.096Z","avatar_url":"https://github.com/qawatake.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fixify\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/qawatake/fixify.svg)](https://pkg.go.dev/github.com/qawatake/fixify)\n[![test](https://github.com/qawatake/fixify/actions/workflows/test.yaml/badge.svg)](https://github.com/qawatake/fixify/actions/workflows/test.yaml)\n[![codecov](https://codecov.io/gh/qawatake/fixify/graph/badge.svg)](https://codecov.io/gh/qawatake/fixify)\n\n`fixify` is a Go library that helps you to write test fixtures in a declarative way.\n\n```go\nfunc TestRun(t *testing.T) {\n\t// specify how to connect models in a declarative way.\n\tf := fixify.New(t,\n\t\tCompany().With(\n\t\t\tDepartment(\"finance\").With(\n\t\t\t\tEmployee(),\n\t\t\t\tEmployee(),\n\t\t\t),\n\t\t\tDepartment(\"sales\").With(\n\t\t\t\tEmployee(),\n\t\t\t\tEmployee(),\n\t\t\t\tEmployee(),\n\t\t\t),\n\t\t),\n\t)\n\t// Apply resolves the dependencies and applies a visitor to each model.\n\tf.Apply(setter)\n\t// finally, run the test!\n}\n\n// Department is a fixture for model.Department.\nfunc Department(name string) *fixify.Model[model.Department] {\n\td := \u0026model.Department{\n\t\tName: name,\n\t}\n\treturn fixify.NewModel(d,\n\t\t// specify how to connect a department to a company.\n\t\tfixify.ConnectorFunc(func(_ testing.TB, department *model.Department, company *model.Company) {\n\t\t\tdepartment.CompanyID = company.ID\n\t\t}),\n\t)\n}\n```\n\nFor more examples, please refer to the [godoc].\n\n## References\n\n- [Goでテストのフィクスチャをいい感じに書く](https://engineering.mercari.com/blog/entry/20220411-42fc0ba69c/)\n\n\u003c!-- links --\u003e\n\n[godoc]: https://pkg.go.dev/github.com/qawatake/fixify\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqawatake%2Ffixify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqawatake%2Ffixify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqawatake%2Ffixify/lists"}