Added tests for JSON Formatter

This commit is contained in:
2023-05-26 15:05:10 +02:00
parent fb128070dc
commit 7e121c7c39

View File

@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "429fb09c-4653-405d-b6cb-de03b624e67b",
"_postman_id": "942d1101-ebd6-4bb6-9415-9feb15558985",
"name": "Release Tools Tests",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
@@ -9657,6 +9657,339 @@
"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": [
@@ -9689,6 +10022,16 @@
"key": "TestURL2",
"value": "http://tools.zipper.release11.com:8082/xpath",
"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"
}
]
}