Skip to content

Commit 2c0117e

Browse files
committed
fixed for BEL child schema; better support
- fixes - moved evidence inside definitions section - moved edge inside graph/properties - fixed evidence JSON pointer in edge metadata - fixed citation/type string enumeration - added test for schema/example validation for bel child schema - refactored tests to subclass Minitest::Unit::TestCase - bumped Gemfile.lock to use latest json-schema and rake deps
2 parents dea6203 + f754b60 commit 2c0117e

6 files changed

Lines changed: 640 additions & 137 deletions

File tree

.build/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
json (1.8.1)
5-
json-schema (2.2.2)
6-
rake (10.3.1)
5+
json-schema (2.2.4)
6+
rake (10.3.2)
77

88
PLATFORMS
99
ruby

.build/test/test-bel.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require 'json'
2+
require 'json-schema'
3+
require 'pathname'
4+
require 'pp'
5+
require 'minitest/autorun'
6+
require 'minitest/unit'
7+
8+
class ExtTest < Minitest::Unit::TestCase
9+
10+
def test_validate_schema
11+
root = Pathname(File.dirname(File.expand_path __FILE__)) + '..' + '..' + 'child-schemas'
12+
schema = JSON.parse File.read(root + 'bel-json-graph.schema.json')
13+
errors = JSON::Validator.fully_validate_schema(schema)
14+
15+
assert errors.empty?, errors.join("\n")
16+
17+
root = Pathname(File.dirname(File.expand_path __FILE__)) + '..' + '..'
18+
data = JSON.parse File.open(root + 'examples' + 'test.network.json', 'r:UTF-8', &:read)
19+
errors = JSON::Validator.fully_validate(schema, data, :insert_defaults => true, :errors_as_objects => true)
20+
21+
if ENV['JGS_VERBOSE']
22+
puts "\n\nValidated JSON for example: examples/test.network.json"
23+
pp data
24+
end
25+
26+
assert errors.empty?, errors.join("\n")
27+
end
28+
end
29+
# vim: ts=2 sts=2 sw=2

.build/test/test-examples.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
require 'json'
22
require 'json-schema'
3-
require 'test/unit'
43
require 'pathname'
5-
6-
class ExamplesTest < Test::Unit::TestCase
4+
require 'minitest/autorun'
5+
require 'minitest/unit'
6+
7+
class ExamplesTest < Minitest::Unit::TestCase
78

89
def setup
910
root = Pathname(File.dirname(File.expand_path __FILE__)) + '..' + '..'

.build/test/test-schema.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
require 'json'
22
require 'json-schema'
3-
require "test/unit"
4-
5-
class SchemaTest < Test::Unit::TestCase
3+
require "minitest/autorun"
4+
require "minitest/unit"
5+
6+
class SchemaTest < Minitest::Unit::TestCase
67

78
def test_validate_schema
89
root = Pathname(File.dirname(File.expand_path __FILE__)) + '..' + '..'

0 commit comments

Comments
 (0)