@@ -12,6 +12,70 @@ 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 missingIssueReportChannel13 = `{
16+ "api": "0.13",
17+ "api_compatibility": ["14"],
18+ "space": "NYCResistor",
19+ "logo": "https://www.nycresistor.com/wp-content/uploads/2017/09/NYCR-logo-wide.png",
20+ "url": "https://www.nycresistor.com/",
21+ "location": {
22+ "address": "87 3rd Avenue, 4th floor, Brooklyn, NY 11217, USA",
23+ "lon": 40.683653,
24+ "lat": -73.981542,
25+ "timezone": "America/New_York"
26+ },
27+ "contact": {
28+ "email": "contact@nycresistor.com",
29+ "matrix": "#public:nycr.chat",
30+ "facebook": "https://www.facebook.com/groups/23644223800/",
31+ "ml": "nycresistormicrocontrollers@googlegroups.com"
32+ },
33+ "state": {
34+ "open": false
35+ },
36+ "links": [
37+ {
38+ "name": "eventbrite",
39+ "url": "http://nycresistor.eventbrite.com/"
40+ },
41+ {
42+ "name": "code of conduct",
43+ "url": "https://www.nycresistor.com/participate/"
44+ },
45+ {
46+ "name": "withfriends",
47+ "url": "https://withfriends.co/nyc_resistor/join"
48+ }
49+ ],
50+ "membership_plans": [
51+ {
52+ "name": "standard",
53+ "value": 115,
54+ "currency": "USD",
55+ "billing_interval": "monthly"
56+ },
57+ {
58+ "name": "teaching",
59+ "value": 75,
60+ "currency": "USD",
61+ "billing_interval": "monthly"
62+ }
63+ ],
64+ "feeds": {
65+ "blog": {
66+ "type": "rss",
67+ "url": "https://www.nycresistor.com/feed/"
68+ },
69+ "wiki": {
70+ "type": "atom",
71+ "url": "https://wiki.nycresistor.com/w/api.php?hidebots=1&urlversion=1&days=30&limit=50&action=feedrecentchanges&feedformat=atom"
72+ },
73+ "calendar": {
74+ "type": "ical",
75+ "url": "https://calendar.google.com/calendar/ical/p2m2av9dhrh4n1ub7jlsc68s7o%40group.calendar.google.com/public/basic.ics"
76+ }
77+ }
78+ }`
1579var noVersion = `{ "data": "asd" }`
1680
1781func TestValidate (t * testing.T ) {
@@ -70,6 +134,15 @@ func TestValidate(t *testing.T) {
70134 t .Error ("Schema should have got 1 errors, got" , len (invalidErrors ))
71135 }
72136
137+ invalidResult , _ = Validate (missingIssueReportChannel13 )
138+ if invalidResult .Valid == true {
139+ t .Error ("Expected validation to be false, got" , invalidResult .Valid )
140+ }
141+ invalidErrors = invalidResult .Errors
142+ if len (invalidErrors ) != 1 {
143+ t .Error ("Schema should have got 1 errors, got" , len (invalidErrors ))
144+ }
145+
73146 invalidResult , _ = Validate (noVersion )
74147 if invalidResult .Valid == true {
75148 t .Error ("Expected validation to be false, got" , invalidResult .Valid )
0 commit comments