diff options
| author | mo khan <mo.khan@gmail.com> | 2020-01-15 15:11:58 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-01-15 15:11:58 -0700 |
| commit | 3e9bbcd897812e64d3a356dcd5806baeec198d65 (patch) | |
| tree | 51db8d3f5d971f348ad7af76c954a7ae64ed3931 | |
| parent | 1046fecb2ea48d6fac210502dbe941725a1f5a71 (diff) | |
Validate version #
| -rw-r--r-- | spec/fixtures/schema/v2.0.json | 30 | ||||
| -rw-r--r-- | spec/integration/dotnet/examples_spec.rb | 1 | ||||
| -rw-r--r-- | spec/integration/python/pip_spec.rb | 2 |
3 files changed, 25 insertions, 8 deletions
diff --git a/spec/fixtures/schema/v2.0.json b/spec/fixtures/schema/v2.0.json index 712143b..6ade7ad 100644 --- a/spec/fixtures/schema/v2.0.json +++ b/spec/fixtures/schema/v2.0.json @@ -7,7 +7,10 @@ "dependencies" ], "properties": { - "version": { "type": "string" }, + "version": { + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, "licenses": { "type": "array", "items": { @@ -18,9 +21,15 @@ "url" ], "properties": { - "id": { "type": "string" }, - "name": { "type": "string" }, - "url": { "type": "uri" } + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "url": { + "type": "uri" + } } } }, @@ -36,9 +45,15 @@ "licenses" ], "properties": { - "name": { "type": "string" }, - "url": { "type": "uri" }, - "description": { "type": "string" }, + "name": { + "type": "string" + }, + "url": { + "type": "uri" + }, + "description": { + "type": "string" + }, "paths": { "type": "array", "items": { @@ -57,4 +72,3 @@ }, "additionalProperties": false } - diff --git a/spec/integration/dotnet/examples_spec.rb b/spec/integration/dotnet/examples_spec.rb index 43caea0..5b2a913 100644 --- a/spec/integration/dotnet/examples_spec.rb +++ b/spec/integration/dotnet/examples_spec.rb @@ -6,6 +6,7 @@ RSpec.describe ".NET Core" do report = runner.scan(env: { 'LICENSE_FINDER_CLI_OPTS' => '--recursive' }) expect(report).not_to be_empty + expect(report).to match_schema(version: '2.0') expect(report[:licenses].count).not_to be_zero expect(report[:dependencies].count).not_to be_zero end diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb index 5ff5f60..b092189 100644 --- a/spec/integration/python/pip_spec.rb +++ b/spec/integration/python/pip_spec.rb @@ -10,6 +10,7 @@ RSpec.describe "pip" do report = runner.scan expect(report).not_to be_empty + expect(report).to match_schema(version: '2.0') expect(report[:version]).to start_with('2') expect(report[:dependencies].map { |x| x[:name] }).to include("sentry-sdk") expect(report[:dependencies].find { |x| x[:name] == 'sentry-sdk' }[:licenses]).to match_array(["BSD-4-Clause"]) @@ -39,6 +40,7 @@ RSpec.describe "pip" do report = runner.scan expect(report).not_to be_empty + expect(report).to match_schema(version: '2.0') expect(report[:version]).to start_with('2') expect(report[:licenses]).not_to be_empty expect(report[:dependencies]).not_to be_empty |
