Added tests for JSON Formatter (#212)
Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: #212 Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"info": {
|
"info": {
|
||||||
"_postman_id": "429fb09c-4653-405d-b6cb-de03b624e67b",
|
"_postman_id": "942d1101-ebd6-4bb6-9415-9feb15558985",
|
||||||
"name": "Release Tools Tests",
|
"name": "Release Tools Tests",
|
||||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||||
},
|
},
|
||||||
@@ -9657,6 +9657,339 @@
|
|||||||
"response": []
|
"response": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "JSON",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "Format Array",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 200\", function () {",
|
||||||
|
" pm.response.to.have.status(200);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = '[\\n {\\n \\\"name\\\": \\\"John\\\",\\n \\\"age\\\": 30.0,\\n \\\"city\\\": \\\"New York\\\"\\n }\\n]';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "[{\"name\": \"John\",\"age\": 30,\"city\": \"New York\"}]",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonFormattingURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonFormattingURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Format Broken Array",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 400\", function () {",
|
||||||
|
" pm.response.to.have.status(400);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = 'End of input at line 1 column 47 path $[1]';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "[{\"name\": \"John\",\"age\": 30,\"city\": \"New York\"}",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonFormattingURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonFormattingURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Format Object",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 200\", function () {",
|
||||||
|
" pm.response.to.have.status(200);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = '{\\n \\\"name\\\": \\\"John\\\",\\n \\\"age\\\": 30.0,\\n \\\"city\\\": \\\"New York\\\"\\n}';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"name\": \"John\",\"age\": 30,\"city\": \"New York\"}",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonFormattingURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonFormattingURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Format Broken Object",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 400\", function () {",
|
||||||
|
" pm.response.to.have.status(400);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = 'End of input at line 1 column 45 path $.city';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\"name\": \"John\",\"age\": 30,\"city\": \"New York\"",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonFormattingURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonFormattingURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minimize Object",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 200\", function () {",
|
||||||
|
" pm.response.to.have.status(200);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = '{\\\"name\\\":\\\"John\\\",\\\"age\\\":30.0,\\\"city\\\":\\\"New York\\\"}';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"John\",\n \"age\": 30,\n \"city\": \"New York\"\n}",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonMinimizeURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonMinimizeURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minimize Broken Object",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 400\", function () {",
|
||||||
|
" pm.response.to.have.status(400);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = 'End of input at line 4 column 23 path $.city';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"name\": \"John\",\n \"age\": 30,\n \"city\": \"New York\"",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonMinimizeURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonMinimizeURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minimize Array",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 200\", function () {",
|
||||||
|
" pm.response.to.have.status(200);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = '[{\\\"name\\\":\\\"John\\\",\\\"age\\\":30.0,\\\"city\\\":\\\"New York\\\"}]';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "[\n {\n \"name\": \"John\",\n \"age\": 30,\n \"city\": \"New York\"\n }\n]",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonMinimizeURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonMinimizeURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minimize Broken Array",
|
||||||
|
"event": [
|
||||||
|
{
|
||||||
|
"listen": "test",
|
||||||
|
"script": {
|
||||||
|
"exec": [
|
||||||
|
"pm.test(\"Status code is 400\", function () {",
|
||||||
|
" pm.response.to.have.status(400);",
|
||||||
|
"});",
|
||||||
|
"pm.test(\"Returns correct result\", function () {",
|
||||||
|
" var jsonData = pm.response.json();",
|
||||||
|
" var expected = 'End of input at line 6 column 6 path $[1]';",
|
||||||
|
" pm.expect(jsonData.data).to.eql(expected);",
|
||||||
|
"});"
|
||||||
|
],
|
||||||
|
"type": "text/javascript"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "[\n {\n \"name\": \"John\",\n \"age\": 30,\n \"city\": \"New York\"\n }",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{JsonMinimizeURL}}",
|
||||||
|
"host": [
|
||||||
|
"{{JsonMinimizeURL}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"event": [
|
"event": [
|
||||||
@@ -9689,6 +10022,16 @@
|
|||||||
"key": "TestURL2",
|
"key": "TestURL2",
|
||||||
"value": "http://tools.zipper.release11.com:8082/xpath",
|
"value": "http://tools.zipper.release11.com:8082/xpath",
|
||||||
"type": "default"
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "JsonFormattingURL",
|
||||||
|
"value": "http://tools-test.zipper.release11.com/java/json/formatting",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "JsonMinimizeURL",
|
||||||
|
"value": "http://tools-test.zipper.release11.com/java/json/minimize",
|
||||||
|
"type": "default"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user