/go-unit-test-redis

📈 Mock Unit Test for Redis in Golang for my Medium story material

Primary LanguageGoMIT LicenseMIT

Build Status codecov Go Report Card

GO-UNIT-TEST-REDIS

Example Mock Unit Test for Redis in Golang

Directory structure

Your project directory structure should look like this

  + your_gopath/
  |
  +--+ src/github.com/moemoe89
  |  |
  |  +--+ go-unit-test-redis/
  |     |
  |     +--+ main.go
  |        + repository/
  |        |
  |        +--+ repository.go
  |           + repository_test.go
  |
  +--+ bin/
  |  |
  |  +-- ... executable file
  |
  +--+ pkg/
     |
     +-- ... all dependency_library required

Setup

$ mkdir -p src/github.com/moemoe89
$ cd src/github.com/moemoe89
$ git clone <url>
$ mv <cloned directory> go-unit-test-redis

How to Run Test

$ go test ./...

License

MIT