Skip to content

Commit bd5e8b3

Browse files
committed
Fix unit tests
1 parent 59ed3a5 commit bd5e8b3

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

codegens/js-fetch/test/unit/convert.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('js-fetch convert function for test collection', function () {
7979
expect.fail(null, null, error);
8080
}
8181
expect(snippet).to.be.a('string');
82-
expect(snippet).to.contain('var raw = JSON.stringify({"data":{"hello":"world"}});');
82+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n});');
8383
});
8484
});
8585

@@ -211,7 +211,7 @@ describe('js-fetch convert function for test collection', function () {
211211
expect.fail(null, null, error);
212212
}
213213
expect(snippet).to.be.a('string');
214-
expect(snippet).to.include('var raw = JSON.stringify({"json":"Test-Test"})');
214+
expect(snippet).to.include('JSON.stringify({\n "json": "Test-Test"\n})');
215215
});
216216
});
217217

codegens/js-jquery/test/unit/converter.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('jQuery converter', function () {
103103
expect.fail(null, null, error);
104104
}
105105
expect(snippet).to.be.a('string');
106-
expect(snippet).to.contain('"data": JSON.stringify({"data":{"hello":"world"}})');
106+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n })');
107107
});
108108
});
109109

@@ -163,7 +163,7 @@ describe('jQuery converter', function () {
163163
expect.fail(null, null, error);
164164
}
165165
expect(snippet).to.be.a('string');
166-
expect(snippet).to.include('"data": JSON.stringify({"json":"Test-Test"})');
166+
expect(snippet).to.include('"data": JSON.stringify({\n "json": "Test-Test"\n }');
167167
});
168168
});
169169

codegens/js-jquery/test/unit/fixtures/snippetFixtures.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Resolve URL (Quotes + Special Characters) Copy": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%3Fa%3D%21@%24%5E*%28%29_-%60%2526%26b%3D%2C./%27%3B%5B%5D%7D%7B%5C%22%3A/%3F%3E%3C%7C%7C%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
88
"POST Raw Text": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22application/x-www-form-urlencoded%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20%22Duis%20posuere%20augue%20vel%20cursus%20pharetra.%20In%20luctus%20a%20ex%20nec%20pretium.%20Praesent%20neque%20quam%2C%20tincidunt%20nec%20leo%20eget%2C%20rutrum%20vehicula%20magna.%5CnMaecenas%20consequat%20elementum%20elit%2C%20id%20semper%20sem%20tristique%20et.%20Integer%20pulvinar%20enim%20quis%20consectetur%20interdum%20volutpat.%21@%23%24%25%5E%26*%28%29+POL%3A%7D%2C%27%27%3B%2C%5B%3B%5B%3B%22%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
99
"POST urlencoded data with disabled entries": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22application/x-www-form-urlencoded%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%221%22%3A%20%22%27a%27%22%2C%0A%20%20%20%20%20%20%20%20%222%22%3A%20%22%5C%22b%5C%22%22%0A%20%20%20%20%7D%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
10-
"POST json with raw": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22application/json%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20JSON.stringify%28%7B%22json%22%3A%22Test-Test%21@%23%24%25%5E%26*%28%29+POL%3A%7D%2C%27%27%3B%2C%5B%3B%5B%3B%3A%3E%22%7D%29%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
10+
"POST json with raw": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22application/json%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20JSON.stringify%28%7B%0A%20%20%20%20%20%20%20%20%22json%22%3A%20%22Test-Test%21@%23%24%25%5E%26*%28%29+POL%3A%7D%2C%27%27%3B%2C%5B%3B%5B%3B%3A%3E%22%0A%20%20%20%20%7D%29%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
1111
"POST javascript with raw": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22application/javascript%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20%22var%20val%20%3D%206%3B%5Cnconsole.log%28val%29%3B%22%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
1212
"POST text/xml with raw": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22text/xml%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20%22%3Cxml%3E%5Cn%5CtTest%20Test%21@%23%24%25%5E%26*%28%29+POL%3A%7D%2C%27%27%3B%2C%5B%3B%5B%3B%5Cn%3C/xml%3E%22%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",
1313
"POST text/html with raw": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//postman-echo.com/post%22%2C%0A%20%20%20%20%22method%22%3A%20%22POST%22%2C%0A%20%20%20%20%22timeout%22%3A%20100%2C%0A%20%20%20%20%22headers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22Content-Type%22%3A%20%22text/html%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22data%22%3A%20%22%3Chtml%3E%5Cn%20%20Test%20Test%20%21@%23%24%25%5E%26*%28%29+POL%3A%7D%2C%27%27%3B%2C%5B%3B%5B%3B%5Cn%3C/html%3E%22%2C%0A%7D%3B%0A%0A%24.ajax%28settings%29.done%28function%20%28response%29%20%7B%0A%20%20%20%20console.log%28response%29%3B%0A%7D%29%3B",

codegens/js-xhr/test/unit/convert.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('js-xhr convert function', function () {
6565
expect.fail(null, null, error);
6666
}
6767
expect(snippet).to.be.a('string');
68-
expect(snippet).to.include('var data = JSON.stringify({"json":"Test-Test"})');
68+
expect(snippet).to.include('JSON.stringify({\n "json": "Test-Test"\n})');
6969
});
7070
});
7171

@@ -99,7 +99,7 @@ describe('js-xhr convert function', function () {
9999
expect.fail(null, null, error);
100100
}
101101
expect(snippet).to.be.a('string');
102-
expect(snippet).to.contain('var data = JSON.stringify({"data":{"hello":"world"}});');
102+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n})');
103103
});
104104
});
105105

codegens/nodejs-axios/test/unit/snippet.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('nodejs-axios convert function', function () {
8080
expect.fail(null, null, error);
8181
}
8282
expect(snippet).to.be.a('string');
83-
expect(snippet).to.contain('var data = JSON.stringify({"data":{"hello":"world"}});');
83+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n})');
8484
});
8585
});
8686

@@ -371,7 +371,7 @@ describe('nodejs-axios convert function', function () {
371371
expect.fail(null, null, error);
372372
}
373373
expect(snippet).to.be.a('string');
374-
expect(snippet).to.include('var data = JSON.stringify({"json":"Test-Test"});');
374+
expect(snippet).to.include('data = JSON.stringify({\n "json": "Test-Test"\n})');
375375
});
376376
});
377377

codegens/nodejs-native/test/unit/snippet.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('nodejs-native convert function', function () {
127127
expect.fail(null, null, error);
128128
}
129129
expect(snippet).to.be.a('string');
130-
expect(snippet).to.contain('var postData = JSON.stringify({"data":{"hello":"world"}});');
130+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n})');
131131
});
132132
});
133133

@@ -267,7 +267,7 @@ describe('nodejs-native convert function', function () {
267267
expect.fail(null, null, error);
268268
}
269269
expect(snippet).to.be.a('string');
270-
expect(snippet).to.include('var postData = JSON.stringify({"json":"Test-Test"})');
270+
expect(snippet).to.include('var postData = JSON.stringify({\n "json": "Test-Test"\n})');
271271
});
272272
});
273273
it('should generate snippets for no files in form data', function () {

codegens/nodejs-request/test/unit/snippet.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('nodejs-request convert function', function () {
6565
expect.fail(null, null, error);
6666
}
6767
expect(snippet).to.be.a('string');
68-
expect(snippet).to.contain('body: JSON.stringify({"data":{"hello":"world"}})');
68+
expect(snippet).to.contain('body: JSON.stringify({\n "data": {\n "hello": "world"\n }\n })');
6969
});
7070
});
7171

@@ -356,7 +356,7 @@ describe('nodejs-request convert function', function () {
356356
expect.fail(null, null, error);
357357
}
358358
expect(snippet).to.be.a('string');
359-
expect(snippet).to.include('body: JSON.stringify({"json":"Test-Test"})');
359+
expect(snippet).to.include('body: JSON.stringify({\n "json": "Test-Test"\n })');
360360
});
361361
});
362362

codegens/nodejs-unirest/test/unit/snippet.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('nodejs unirest convert function', function () {
7878
expect.fail(null, null, error);
7979
}
8080
expect(snippet).to.be.a('string');
81-
expect(snippet).to.contain('send(JSON.stringify({"data":{"hello":"world"}}))');
81+
expect(snippet).to.contain('JSON.stringify({\n "data": {\n "hello": "world"\n }\n })');
8282
});
8383
});
8484

@@ -193,7 +193,7 @@ describe('nodejs unirest convert function', function () {
193193
expect.fail(null, null, error);
194194
}
195195
expect(snippet).to.be.a('string');
196-
expect(snippet).to.include('.send(JSON.stringify({"json":"Test-Test"}))');
196+
expect(snippet).to.include('.send(JSON.stringify({\n "json": "Test-Test"\n }))');
197197
});
198198
});
199199

0 commit comments

Comments
 (0)