@@ -12,6 +12,7 @@ var invalid14 = `{ "api_compatibility": [ "14" ], "space_invalid": "example", "u
1212var valid15 = `{ "api_compatibility": [ "15" ], "space": "example", "url": "https://example.com", "logo": "https://example.com/logo.png", "location": { "lon": 42, "lat": 23 }, "state": { "open": true }, "contact": {} }`
1313var invalid15 = `{ "api_compatibility": [ "15" ], "space_invalid": "example", "url": "https://example.com", "logo": "https://example.com/logo.png", "location": { "lon": 42, "lat": 23 }, "state": { "open": true }, "contact": {} }`
1414var wrongVersionNumeric = `{ "api": 0.13, "open": true, "space": "example", "url": "https://example.com", "logo": "https://example.com/logo.png", "location": { "lon": 42, "lat": 23 }, "state": { "open": true }, "contact": {}, "issue_report_channels": [ "email" ] }`
15+ var noVersion = `{ "data": "asd" }`
1516
1617func TestValidate (t * testing.T ) {
1718 invalidResult , _ := Validate (invalid13 )
@@ -69,6 +70,16 @@ func TestValidate(t *testing.T) {
6970 t .Error ("Schema should have got 1 errors, got" , len (invalidErrors ))
7071 }
7172
73+ invalidResult , _ = Validate (noVersion )
74+ if invalidResult .Valid == true {
75+ t .Error ("Expected validation to be false, got" , invalidResult .Valid )
76+ }
77+ invalidErrors = invalidResult .Errors
78+ if len (invalidErrors ) != 6 {
79+ t .Logf ("%v" , invalidResult )
80+ t .Error ("Schema should have got 1 errors, got" , len (invalidErrors ))
81+ }
82+
7283 validResult , err := Validate ("" )
7384 if err == nil {
7485 t .Error ("Should provide an error on faulty json" )
0 commit comments