Skip to content

Commit

Permalink
Merge pull request #750 from postmanlabs/feature/update-postman-colle…
Browse files Browse the repository at this point in the history
…ction-usage

Updated "postman-collection" usage to be specific to part of module being used.
  • Loading branch information
VShingala authored Jul 10, 2024
2 parents c9f0527 + 4872164 commit 08ad33c
Show file tree
Hide file tree
Showing 50 changed files with 473 additions and 457 deletions.
32 changes: 16 additions & 16 deletions codegens/csharp-httpclient/test/unit/convert.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var expect = require('chai').expect,
sdk = require('postman-collection'),
{ Request } = require('postman-collection/lib/collection/request'),
convert = require('../../lib/index').convert,
mainCollection = require('./fixtures/testcollection/collection.json'),
testCollection = require('./fixtures/testcollection/collectionForEdge.json'),
Expand All @@ -13,7 +13,7 @@ describe('csharp httpclient function', function () {

describe('csharp-httpclient convert function', function () {
it('should return expected snippet', function () {
var request = new sdk.Request(mainCollection.item[10].request),
var request = new Request(mainCollection.item[10].request),
options = {
indentCount: 1,
indentType: 'Tab'
Expand All @@ -30,7 +30,7 @@ describe('csharp httpclient function', function () {
});

describe('convert function', function () {
var request = new sdk.Request(testCollection.item[0].request),
var request = new Request(testCollection.item[0].request),
snippetArray,
options = {
includeBoilerplate: true,
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('csharp httpclient function', function () {
});

it('should create custom HttpMethod when method is non-standard', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'NOTNORMAL',
'header': [],
'url': {
Expand All @@ -116,7 +116,7 @@ describe('csharp httpclient function', function () {
});

it('should add fake body when content type header added to empty body', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'DELETE',
'body': {},
'header': [
Expand All @@ -137,7 +137,7 @@ describe('csharp httpclient function', function () {
});

// it('should only include one System.IO using with multiple files', function () {
// var request = new sdk.Request({
// var request = new Request({
// 'method': 'POST',
// 'header': [],
// 'body': {
Expand Down Expand Up @@ -171,7 +171,7 @@ describe('csharp httpclient function', function () {
// });

it('should include multiple form content when file has multiple sources', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'body': {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('csharp httpclient function', function () {
});

it('should include graphql body in the snippet', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'body': {
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('csharp httpclient function', function () {
});

it('should add blank graphql variables when invalid', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'body': {
Expand Down Expand Up @@ -271,7 +271,7 @@ describe('csharp httpclient function', function () {
});

it('should not add multiport form content when disabled', function () {
var request = new sdk.Request(mainCollection.item[15].request);
var request = new Request(mainCollection.item[15].request);
convert(request, {}, function (error, snippet) {
if (error) {
expect.fail(null, null, error);
Expand All @@ -288,7 +288,7 @@ describe('csharp httpclient function', function () {
});

it('should run add content as string on raw request', function () {
var request = new sdk.Request(mainCollection.item[12].request);
var request = new Request(mainCollection.item[12].request);
convert(request, {}, function (error, snippet) {
if (error) {
expect.fail(null, null, error);
Expand All @@ -303,7 +303,7 @@ describe('csharp httpclient function', function () {
});

it('should add a file on file request', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'url': 'https://google.com',
'header': [],
Expand All @@ -324,7 +324,7 @@ describe('csharp httpclient function', function () {
});

it('should add all enabled headers to request', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'url': 'https://postman-echo.com/post',
'header': [
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('csharp httpclient function', function () {
});

it('should skip disabled form url encoded values', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'url': 'https://postman-echo.com/post',
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('csharp httpclient function', function () {
});

it('should skip collection initialization when no urlencoded values are enabled', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'url': 'https://postman-echo.com/post',
Expand All @@ -415,7 +415,7 @@ describe('csharp httpclient function', function () {
});

it('should skip creating multipart form data content when all values are disabled', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'url': 'https://postman-echo.com/post',
Expand Down
14 changes: 7 additions & 7 deletions codegens/csharp-restsharp/test/unit/convert.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var expect = require('chai').expect,
sdk = require('postman-collection'),
{ Request } = require('postman-collection/lib/collection/request'),
convert = require('../../lib/index').convert,
mainCollection = require('./fixtures/testcollection/collection.json'),
testCollection = require('./fixtures/testcollection/collectionForEdge.json'),
Expand All @@ -13,7 +13,7 @@ describe('csharp restsharp function', function () {

describe('csharp-restsharp convert function', function () {
it('should return expected snippet - Async', function () {
var request = new sdk.Request(mainCollection.item[4].request),
var request = new Request(mainCollection.item[4].request),
options = {
indentCount: 1,
indentType: 'Tab',
Expand All @@ -31,7 +31,7 @@ describe('csharp restsharp function', function () {
});

it('should return expected snippet json params', function () {
var request = new sdk.Request(mainCollection.item[5].request),
var request = new Request(mainCollection.item[5].request),
options = {
indentCount: 1,
indentType: 'Tab',
Expand All @@ -50,7 +50,7 @@ describe('csharp restsharp function', function () {
});

describe('convert function', function () {
var request = new sdk.Request(testCollection.item[0].request),
var request = new Request(testCollection.item[0].request),
snippetArray,
options = {
includeBoilerplate: true,
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('csharp restsharp function', function () {
});

it('should trim header keys and not trim header values', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'GET',
'header': [
{
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('csharp restsharp function', function () {
});

it('should generate snippets for no files in form data', function () {
var request = new sdk.Request({
var request = new Request({
'method': 'POST',
'header': [],
'body': {
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('csharp restsharp function', function () {
const sampleUA = 'Safari/605.1.15',
expectValue = `UserAgent = "${sampleUA}",`;

var request = new sdk.Request({
var request = new Request({
'method': 'GET',
'header': [
{
Expand Down
Loading

0 comments on commit 08ad33c

Please sign in to comment.