func TestCreateUser(t *testing.T) {
	s := setup()
	email := "jdoe@example.com"
	password := "Pa$$w0rd"
	err := s.Create("first", "last", email, password)
	assert.Equal(t, err, nil)
	err = s.Create("first", "last", email, password)
	assert.Equal(t, err, domain.ErrUserAlreadyExist)
	uTest, err := s.ByEmail(email)
	assert.Equal(t, err, nil)
	assert.Equal(t, uTest.Email, email)
	_, err = s.ByEmail("bademail@example.com")
	assert.Equal(t, err, domain.ErrUserNotFound)
}
TestCreateUser ensures user can be created.
package domain_test
import (
	"errors"
	"testing"
	"github.com/josephspurrier/gocleanarchitecture/adapter"
	"github.com/josephspurrier/gocleanarchitecture/adapter/jsonrepo"
	"github.com/josephspurrier/gocleanarchitecture/domain"
	"github.com/josephspurrier/gocleanarchitecture/lib/jsondb"
	"github.com/stretchr/testify/assert"
)
type BadHasher struct{}
func (s *BadHasher) Hash(password string) (string, error) {
	return "", errors.New("Forced error.")
}
func (s *BadHasher) Match(hash, password string) bool {
	return false
}
func setup() *domain.UserService {
	return domain.NewUserService(
		jsonrepo.NewUserRepo(new(jsondb.MockService)),
		new(adapter.Passhash))
}