forked from codecrafters-io/tester-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester_definition_test.go
46 lines (35 loc) · 1.25 KB
/
tester_definition_test.go
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
35
36
37
38
39
40
41
42
43
44
45
46
package tester_utils
import (
"testing"
"github.com/stretchr/testify/assert"
testingInterface "github.com/mitchellh/go-testing-interface"
)
func TestTestAgainstYAMLFailure(t *testing.T) {
definition := TesterDefinition{
Stages: []Stage{
{Slug: "test-1"},
{Slug: "test-2"},
},
}
runtimeT := &testingInterface.RuntimeT{}
yamlPath := "test_helpers/tester_definition_test/course_definition.yml"
definition.TestAgainstYAML(runtimeT, yamlPath)
assert.True(t, runtimeT.Failed())
}
func TestTestAgainstYAMLSuccess(t *testing.T) {
definition := TesterDefinition{
Stages: []Stage{
{Slug: "init", Title: "Bind to a port", Number: 1},
{Slug: "ping-pong", Title: "Respond to PING", Number: 2},
{Slug: "ping-pong-multiple", Title: "Respond to multiple PINGs", Number: 3},
{Slug: "concurrent-clients", Title: "Handle concurrent clients", Number: 4},
{Slug: "echo", Title: "Implement the ECHO command", Number: 5},
{Slug: "set_get", Title: "Implement the SET & GET commands", Number: 6},
{Slug: "expiry", Title: "Expiry", Number: 7},
},
}
runtimeT := &testingInterface.RuntimeT{}
yamlPath := "test_helpers/tester_definition_test/course_definition.yml"
definition.TestAgainstYAML(runtimeT, yamlPath)
assert.False(t, runtimeT.Failed())
}