Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated "postman-collection" usage to be specific to part of module being used. #750

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading