Skip to content

Commit

Permalink
add common fixtures to go etech common libs
Browse files Browse the repository at this point in the history
  • Loading branch information
somolinosm authored and adrianpozueco committed Jul 7, 2021
1 parent 31ddafb commit aae8fb7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fixtures/slices.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package fixtures

func Contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
30 changes: 30 additions & 0 deletions fixtures/slices_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package fixtures

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestContainsOk(t *testing.T) {
//Given
stringSet := []string{"a", "b", "c"}
message := "b"

//When
result := Contains(stringSet, message)

//Then
assert.True(t, result)

}

func TestContainsError(t *testing.T) {
stringSet := []string{"a", "b", "c"}
message := "m"

//When
result := Contains(stringSet, message)

//Then
assert.False(t, result)
}

0 comments on commit aae8fb7

Please sign in to comment.