{"id":42855399,"url":"https://github.com/fajarcandraaa/simple-golang-unit-testing","last_synced_at":"2026-01-30T12:19:32.732Z","repository":{"id":120111295,"uuid":"608192857","full_name":"fajarcandraaa/simple-golang-unit-testing","owner":"fajarcandraaa","description":"Simple Golang Unit Testing","archived":false,"fork":false,"pushed_at":"2023-03-01T15:55:51.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T03:39:27.498Z","etag":null,"topics":["backend","backenddeveloper","go","golang","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fajarcandraaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-01T14:10:41.000Z","updated_at":"2023-03-01T15:57:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"b69262be-77bd-43f7-add3-190b04f615ad","html_url":"https://github.com/fajarcandraaa/simple-golang-unit-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fajarcandraaa/simple-golang-unit-testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarcandraaa%2Fsimple-golang-unit-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarcandraaa%2Fsimple-golang-unit-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarcandraaa%2Fsimple-golang-unit-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarcandraaa%2Fsimple-golang-unit-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fajarcandraaa","download_url":"https://codeload.github.com/fajarcandraaa/simple-golang-unit-testing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarcandraaa%2Fsimple-golang-unit-testing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backend","backenddeveloper","go","golang","unit-testing"],"created_at":"2026-01-30T12:19:31.127Z","updated_at":"2026-01-30T12:19:32.727Z","avatar_url":"https://github.com/fajarcandraaa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Golang Unit Testing\n\n![Simple Golang Unit Testing](https://i.ytimg.com/vi/IorsKSduDaM/maxresdefault.jpg)\n\nWe will learn about implement unit testing in Golang.\n\n## Topics :\n- Setting up the Golang Project\n- Defining the Product Entity\n- Connecting to the database\n- Implementing Unit test with 1 feature, it's find data by ID\n\n## Our Step :\n- In the first step, we create an entities to represent the structure of our data in the entity package\n- In the second step, we create query a function to handle our query\n- Then register the new function in our model interface\n- In the third step, we create algorithm function to handle all condition in our flow proccess\n- and again, we register it into source contract interface\n- In fourth step is create faker data or mock data\n- than, we create a seederes, to input fake data to database testing\n- And the last step is, we create unit test with 2 case, 1 positive cae and 1 negative case\n\n## Notes :\nLast but not least, let's start to try to write a function that we think will be used many times in helpers.\nHappy coding and keep learning 😜\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarcandraaa%2Fsimple-golang-unit-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffajarcandraaa%2Fsimple-golang-unit-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarcandraaa%2Fsimple-golang-unit-testing/lists"}