-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathParseFlags_test.go
More file actions
34 lines (29 loc) · 796 Bytes
/
ParseFlags_test.go
File metadata and controls
34 lines (29 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
type parseArgumentsTestCase struct {
args []string
searchInput SearchInput
recipient string
}
func TestParseArguments(t *testing.T) {
testCases := getTestCases()
for _, testCase := range testCases {
t.Run("It parses the argumentents provided", func(t *testing.T) {
searchInput, recipient := ParseFlags("test", testCase.args)
assert.Equal(t, testCase.searchInput, searchInput)
assert.Equal(t, testCase.recipient, recipient)
})
}
}
func getTestCases() []parseArgumentsTestCase {
return []parseArgumentsTestCase{
{
[]string{"-departure=FCO", "-arrival=AMS", "-date=2020-02-02", "-recipient=test@example.com"},
SearchInput{"FCO", "AMS", "2020-02-02"},
"test@example.com",
},
}
}