-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep2_test.go
61 lines (47 loc) · 1.24 KB
/
step2_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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"fmt"
"log"
"os"
"testing"
)
func Test_StartTest2(t *testing.T) {
fmt.Println()
log.Println("Testing step 2")
}
func TestValidate_Step2_ValidJSON1_ReturnTrue(t *testing.T) {
log.Println("TestValidate_Step2_ValidJSON1_ReturnTrue")
file, _ := os.Open("tests/step2/valid.json")
defer file.Close()
isValid := ValidateJSON(file)
if !isValid {
t.Errorf("Expected true, got false")
}
}
func TestValidate_Step2_ValidJSON2_ReturnTrue(t *testing.T) {
log.Println("TestValidate_Step2_ValidJSON2_ReturnTrue")
file, _ := os.Open("tests/step2/valid2.json")
defer file.Close()
isValid := ValidateJSON(file)
if !isValid {
t.Errorf("Expected true, got false")
}
}
func TestValidate_Step2_InvalidJSON1_ReturnFalse(t *testing.T) {
log.Println("TestValidate_Step2_InvalidJSON1_ReturnFalse")
file, _ := os.Open("tests/step2/invalid.json")
defer file.Close()
isValid := ValidateJSON(file)
if isValid {
t.Errorf("Expected false, got true")
}
}
func TestValidate_Step2_InvalidJSON2_ReturnFalse(t *testing.T) {
log.Println("TestValidate_Step2_InvalidJSON2_ReturnFalse")
file, _ := os.Open("tests/step2/invalid2.json")
defer file.Close()
isValid := ValidateJSON(file)
if isValid {
t.Errorf("Expected false, got true")
}
}