Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynom committed Apr 14, 2020
1 parent 5edaf51 commit 7941cf9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
1 change: 0 additions & 1 deletion cmd/web/erihttp/handlers/pathstrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func TestWithPathStrip(t *testing.T) {
logger, _ := testLog.NewNullLogger()
h := WithPathStrip(logger, tt.stripPath)

// Creating a mock response and request object
mockResponse := httptest.NewRecorder()
mockRequest := httptest.NewRequest(http.MethodPost, tt.requestPath, strings.NewReader(""))

Expand Down
6 changes: 3 additions & 3 deletions cmd/web/hitlist/hitlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,9 @@ func TestHitList_GetInternalTypes(t *testing.T) {
}{
{
name: "All good",
p: types.NewEmailFromParts("john", "gmail.com"),
p: types.NewEmailFromParts("john", "example.org"),
wantRecipient: []byte("nhoj"),
wantDomain: "gmail.com",
wantDomain: "example.org",
wantErr: false,
},
{
Expand All @@ -702,7 +702,7 @@ func TestHitList_GetInternalTypes(t *testing.T) {
},
{
name: "No recipient",
p: types.NewEmailFromParts("", "gmail.com"),
p: types.NewEmailFromParts("", "example.org"),
wantRecipient: Recipient(""),
wantDomain: "",
wantErr: true,
Expand Down
20 changes: 6 additions & 14 deletions cmd/web/persister/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ func (s MockHasher) Write(p []byte) (int, error) {
}

func (s MockHasher) Sum(p []byte) []byte {

// Make sure we did something, reverse the input
//var r = make([]byte, len(p))
//for i, v := range p {
// j := len(r) - 1 - i
// r[j] = v
//}

return p
}

Expand Down Expand Up @@ -75,13 +67,13 @@ func TestStorage_Range(t *testing.T) {

testData := []testDataS{
{
parts: types.NewEmailFromParts("john", "gmail.com"),
parts: types.NewEmailFromParts("john", "example.org"),
vr: validator.Result{
Validations: validations.Validations(validations.FSyntax),
Steps: validations.Steps(validations.FSyntax | validations.FMXLookup),
},
}, {
parts: types.NewEmailFromParts("jane", "gmail.com"),
parts: types.NewEmailFromParts("jane", "example.org"),
vr: validator.Result{
Validations: validations.Validations(validations.FSyntax | validations.FMXLookup),
Steps: validations.Steps(validations.FSyntax | validations.FMXLookup),
Expand Down Expand Up @@ -180,7 +172,7 @@ func TestStorage_Range(t *testing.T) {
s := NewMemory(list).(*Memory)

// Preparing data with a good key, and with a bad vr type.
s.m.Store("john@gmail.com", "bar")
s.m.Store("john@example.org", "bar")

var collected uint
const want = 0
Expand Down Expand Up @@ -217,7 +209,7 @@ func TestStorage_Store(t *testing.T) {
name: "Basic store",
args: args{
ctx: ctxNormal,
parts: types.NewEmailFromParts("john", "gmail.com"),
parts: types.NewEmailFromParts("john", "example.org"),
},
wantErr: false,
wantStored: true,
Expand All @@ -226,7 +218,7 @@ func TestStorage_Store(t *testing.T) {
name: "Canceled context",
args: args{
ctx: ctxCanceled,
parts: types.NewEmailFromParts("john", "gmail.com"),
parts: types.NewEmailFromParts("john", "example.org"),
},
wantErr: true,
wantStored: false,
Expand Down Expand Up @@ -258,7 +250,7 @@ func TestStorage_Store(t *testing.T) {
return nil
})

if got := (collected > 0); tt.wantStored != got {
if got := collected > 0; tt.wantStored != got {
t.Errorf("Expected the items to have been stored, want %t, got %t ", tt.wantStored, got)
}
})
Expand Down

0 comments on commit 7941cf9

Please sign in to comment.