Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/mock/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

var mainTestCases = map[string]test.MainParams{
"no mocks": {
"no-mocks": {
Args: []string{"mock"},
Env: []string{},
ExitCode: 0,
Expand Down
10 changes: 5 additions & 5 deletions gock/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ type ControllerParams struct {
}

var controllerTestCases = map[string]ControllerParams{
"match with bar": {
"match-with-bar": {
url: "http://foo.com/bar",
expectMatch: test.Success,
},
"match with baz": {
"match-with-baz": {
url: "http://foo.com/baz",
expectMatch: test.Success,
},
"missing host": {
"missing-host": {
url: "http://bar.com/baz",
expectError: gock.ErrCannotMatch,
},
"missing path": {
"missing-path": {
url: "http://foo.com/foo",
expectError: gock.ErrCannotMatch,
},
"missing schema": {
"missing-schema": {
url: "https://foo.com/bar",
expectError: assert.AnError,
},
Expand Down
10 changes: 5 additions & 5 deletions gock/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,21 @@ type MatchParams struct {
}

var matchTestCases = map[string]MatchParams{
"match with bar": {
"match-with-bar": {
url: "http://foo.com/bar",
expectMatch: true,
},
"match with baz": {
"match-with-baz": {
url: "http://foo.com/baz",
expectMatch: true,
},
"missing host": {
"missing-host": {
url: "http://bar.com/baz",
},
"missing path": {
"missing-path": {
url: "http://foo.com/foo",
},
"missing schema": {
"missing-schema": {
url: "https://foo.com/bar",
expectError: assert.AnError,
},
Expand Down
14 changes: 7 additions & 7 deletions internal/maps/maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ type CopyParams struct {
}

var copyTestCases = map[string]CopyParams{
"empty map": {
"empty-map": {
input: map[string]int{},
expect: map[string]int{},
},
"single key-value pair": {
"single-key-value-pair": {
input: map[string]int{"a": 1},
expect: map[string]int{"a": 1},
},
"multiple key-value pairs": {
"multiple-key-value-pairs": {
input: map[string]int{"a": 1, "b": 2, "c": 3},
expect: map[string]int{"a": 1, "b": 2, "c": 3},
},
Expand All @@ -47,22 +47,22 @@ type AddParams struct {
}

var addTestCases = map[string]AddParams{
"no sources": {
"no-sources": {
target: map[string]int{"a": 1},
sources: []map[string]int{},
expect: map[string]int{"a": 1},
},
"single source": {
"single-source": {
target: map[string]int{"a": 1},
sources: []map[string]int{{"b": 2}},
expect: map[string]int{"a": 1, "b": 2},
},
"multiple sources with no conflicts": {
"multiple-sources-with-no-conflicts": {
target: map[string]int{"a": 1},
sources: []map[string]int{{"b": 2}, {"c": 3}},
expect: map[string]int{"a": 1, "b": 2, "c": 3},
},
"multiple sources with conflicts": {
"multiple-sources-with-conflicts": {
target: map[string]int{"a": 1},
sources: []map[string]int{{"a": 2}, {"a": 3, "b": 4}},
expect: map[string]int{"a": 3, "b": 4},
Expand Down
20 changes: 10 additions & 10 deletions internal/mock/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ type FileBuilderParams struct {
}

var fileBuilderTestCases = map[string]FileBuilderParams{
"import double": {
"import-double": {
setup: test.Panic(NewErrAliasConflict(
importMockTest, pathTest)),
target: targetMockIFace,
imports: []*Import{importMockTest, importMockTest},
},

"import illegal": {
"import-illegal": {
setup: test.Panic(NewErrIllegalImport(importIllegal)),
target: targetMockIFace,
imports: []*Import{importIllegal},
},

"no imports": {
"no-imports": {
target: targetMockIFace,
mocks: []*Mock{{
Methods: methodsLoadIFace,
Expand All @@ -60,7 +60,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"others imported": {
"others-imported": {
target: targetMockIFace,
imports: []*Import{
ImportReflect, ImportGomock, ImportMock,
Expand All @@ -80,7 +80,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"pre imported": {
"pre-imported": {
target: targetMockIFace,
imports: []*Import{
ImportReflect, importTest, importMock, importMockTest,
Expand All @@ -99,7 +99,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"alias imported": {
"alias-imported": {
target: targetMockIFace,
imports: []*Import{importAlias(pkgTest)},
mocks: []*Mock{{
Expand All @@ -118,7 +118,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"package imported": {
"package-imported": {
target: targetMockIFace,
imports: []*Import{
importAlias(pkgTest),
Expand All @@ -143,7 +143,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"internal imported": {
"internal-imported": {
target: targetMockIFace,
imports: []*Import{
importAlias(pkgTest),
Expand All @@ -168,7 +168,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"organization imported": {
"organization-imported": {
target: targetMockIFace,
imports: []*Import{
importAlias(pkgTest),
Expand Down Expand Up @@ -197,7 +197,7 @@ var fileBuilderTestCases = map[string]FileBuilderParams{
},
},

"import conflict": {
"import-conflict": {
setup: test.Panic(NewErrAliasConflict(&Import{
Alias: aliasGitHub, Path: pathTest,
}, pathTest)),
Expand Down
4 changes: 2 additions & 2 deletions internal/mock/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var generateTestCases = map[string]GenerateParams{
expectFile: expectIFace,
},

"failure parsing": {
"failure-parsing": {
file: filepath.Join(testDirGenerate, MockFileDefault),
args: []string{pathUnknown},
expectStderr: NewErrArgFailure(3, ".",
Expand All @@ -54,7 +54,7 @@ var generateTestCases = map[string]GenerateParams{
expectCode: 1,
},

"failure opening": {
"failure-opening": {
file: fileFailure,
args: []string{pathTest},
expectStderr: NewErrFileOpening(fileFailure, &fs.PathError{
Expand Down
Loading
Loading