Skip to content

Commit

Permalink
Merge pull request #3492 from snyk/chore/add-tests-for-test-json-output
Browse files Browse the repository at this point in the history
chore: Added tests for IaC JSON test output
  • Loading branch information
ofekatr authored Aug 1, 2022
2 parents 27db3a3 + f66ee0d commit 3016a01
Show file tree
Hide file tree
Showing 7 changed files with 824 additions and 108 deletions.
344 changes: 271 additions & 73 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@snyk/graphlib": "^2.1.9-patch.3",
"@snyk/snyk-cocoapods-plugin": "2.5.2",
"@snyk/snyk-hex-plugin": "1.1.4",
"@types/jest-json-schema": "^6.1.1",
"@types/marked": "^4.0.0",
"abbrev": "^1.1.1",
"adm-zip": "^0.5.9",
Expand All @@ -82,6 +83,7 @@
"env-paths": "^2.0.0",
"glob": "^7.1.7",
"global-agent": "^2.1.12",
"jest-json-schema": "^6.1.0",
"jsondiffpatch": "^0.4.1",
"lodash.assign": "^4.2.0",
"lodash.camelcase": "^4.3.0",
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/iac/output-formats/test-error-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "object",
"properties": {
"ok": { "type": "boolean" },
"error": { "type": "string" },
"path": { "type": "string" }
},
"required": ["ok", "error", "path"],
"additionalProperties": false
}
250 changes: 250 additions & 0 deletions test/fixtures/iac/output-formats/test-result-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
{
"type": "object",
"properties": {
"meta": {
"type": "object",
"properties": {
"isPrivate": {
"type": "boolean"
},
"isLicensesEnabled": {
"type": "boolean"
},
"org": {
"type": "string"
},
"ignoreSettings": {
"type": "object",
"properties": {
"adminOnly": {
"type": "boolean"
},
"reasonRequired": {
"type": "boolean"
},
"disregardFilesystemIgnores": {
"type": "boolean"
}
},
"required": [
"adminOnly",
"reasonRequired",
"disregardFilesystemIgnores"
],
"additionalProperties": false,
"nullable": true
},
"projectId": {
"type": "string"
},
"policy": {
"type": "string"
},
"gitRemoteUrl": {
"type": "string"
}
},
"required": [
"isPrivate",
"isLicensesEnabled",
"org"
],
"additionalFields": false
},
"filesystemPolicy": {
"type": "boolean"
},
"dependencyCount": {
"type": "number"
},
"licensesPolicy": {
"type": "null"
},
"ignoreSettings": {
"type": "null"
},
"vulnerabilities": {
"type": "array",
"maxItems": 0
},
"targetFile": {
"type": "string"
},
"projectName": {
"type": "string"
},
"org": {
"type": "string"
},
"policy": {
"type": "string",
"maxLength": 0
},
"isPrivate": {
"type": "boolean"
},
"targetFilePath": {
"type": "string"
},
"packageManager": {
"type": "string"
},
"path": {
"type": "string"
},
"projectType": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"infrastructureAsCodeIssues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"publicId": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"severity": {
"type": "string",
"enum": [
"low",
"medium",
"high",
"critical"
]
},
"isIgnored": {
"type": "boolean"
},
"type": {
"type": "string"
},
"subType": {
"type": "string"
},
"policyEngineType": {
"type": "string"
},
"references": {
"type": "array",
"items": {
"type": "string"
}
},
"path": {
"type": "array",
"items": {
"type": "string"
}
},
"documentation": {
"type": "string"
},
"isGeneratedByCustomRule": {
"type": "boolean"
},
"issue": {
"type": "string"
},
"impact": {
"type": "string"
},
"resolve": {
"type": "string"
},
"remediation": {
"type": "object",
"terraform": {
"type": "string"
},
"cloudformation": {
"type": "string"
},
"arm": {
"type": "string"
},
"kubernetes": {
"type": "string"
}
},
"msg": {
"type": "string"
},
"compliance": {
"type": "array",
"maxItems": 0
},
"lineNumber": {
"type": "number"
},
"iacDescription": {
"type": "object",
"properties": {
"issue": {
"type": "string"
},
"impact": {
"type": "string"
},
"resolve": {
"type": "string"
}
},
"required": [
"issue",
"impact",
"resolve"
],
"additionalProperties": false
}
},
"requires": [
"id",
"publicId",
"title",
"severity",
"isIgnored",
"subType",
"references",
"issue",
"impact",
"resolve",
"msg",
"iacDescription"
],
"additionalProperties": true
}
}
},
"required": [
"meta",
"filesystemPolicy",
"dependencyCount",
"licensesPolicy",
"ignoreSettings",
"vulnerabilities",
"targetFile",
"projectName",
"org",
"policy",
"isPrivate",
"targetFilePath",
"packageManager",
"path",
"projectType",
"ok",
"infrastructureAsCodeIssues"
],
"additionalProperties": false
}
Loading

0 comments on commit 3016a01

Please sign in to comment.