diff --git a/spec/srb_json_load_spec.rb b/spec/srb_json_load_spec.rb new file mode 100644 index 00000000..2e2e6ea6 --- /dev/null +++ b/spec/srb_json_load_spec.rb @@ -0,0 +1,25 @@ +require 'json' + +require './lib/models/driver' + +JSON_TYPES_MAP = { + './lib/engines/hcktest/drivers/*.json' => AutoHCK::Models::Driver, +}.freeze + +describe 'srb_json_load' do + Dir['./**/*.json'].each do |json_file| + next if json_file.include? 'jtd.json' + + it json_file.to_s do + types = JSON_TYPES_MAP.filter_map { |json_files_pattern, type| type if File.fnmatch(json_files_pattern, json_file) } + + if types.empty? + pending("NO TYPE FOR #{json_file}") + raise + end + + data = types.first.from_json_file(json_file) + expect(data).not_to be_nil + end + end +end