https://github.com/vinbyte/protip-golang-testing
Some ProTip about Golang Testing
https://github.com/vinbyte/protip-golang-testing
Last synced: about 2 months ago
JSON representation
Some ProTip about Golang Testing
- Host: GitHub
- URL: https://github.com/vinbyte/protip-golang-testing
- Owner: vinbyte
- Created: 2021-06-01T08:32:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-01T10:43:19.000Z (over 4 years ago)
- Last Synced: 2024-06-20T21:12:47.998Z (over 1 year ago)
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unit Testing using Go-chi and SQLMock
## Overview
Some ProTip about Golang unit testing when the app using [go-chi](https://github.com/go-chi/chi) and [sqlmock](https://github.com/DATA-DOG/go-sqlmock).
## How to Run
### Docker
- Run your docker
- Run `docker-compose up`
### Non Docker
- Copy paste `.env.sample` to `.env` and set your database credential
- Run `go run app/main.go`
## Test
- Run `go test -v ./...`
## Routes
| Endpoint | Method | Description
| --- | --- | --- |
| `/v1/users` | `GET` | getting list of users |
| `v1/users/{id}` | `GET` | getting user by user id |