Skip to content

Commit

Permalink
Test typo fixes, skip double test runs on PR and fixes to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhwaneet Bhatt committed Mar 20, 2023
1 parent f31e1da commit a5f455b
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 28 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Test

on: [push, pull_request]
on:
push:
branches:
- develop
- master
pull_request:

jobs:
Unit-Tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
2 changes: 1 addition & 1 deletion codegens/http/test/resources/test-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
2 changes: 1 addition & 1 deletion codegens/js-jquery/test/unit/fixtures/snippetFixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"UNLINK request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22UNLINK%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/plain%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.%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",
"LOCK request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22LOCK%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/plain%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.%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",
"UNLOCK request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22UNLOCK%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",
"PROFIND request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22PROPFIND%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/plain%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.%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",
"PROPFIND request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22PROPFIND%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/plain%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.%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",
"VIEW request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//mockbin.org/request%22%2C%0A%20%20%20%20%22method%22%3A%20%22VIEW%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/plain%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.%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",
"PURGE Request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io%22%2C%0A%20%20%20%20%22method%22%3A%20%22PURGE%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",
"COPY Request": "var%20settings%20%3D%20%7B%0A%20%20%20%20%22url%22%3A%20%22https%3A//9c76407d-5b8d-4b22-99fb-8c47a85d9848.mock.pstmn.io%22%2C%0A%20%20%20%20%22method%22%3A%20%22COPY%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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
2 changes: 1 addition & 1 deletion codegens/kotlin-okhttp/test/unit/validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('package.json', function () {
expect(package.com_postman_plugin.type).to.equal('code_generator');
expect(package.com_postman_plugin.lang).to.be.a('string');
expect(package.com_postman_plugin.variant).to.be.a('string');
expect(package.com_postman_plugin.syntax_mode).to.be.equal('java');
expect(package.com_postman_plugin.syntax_mode).to.be.equal('kotlin');
});
it('should have main property with relative path to object with convert property', function () {
var languageModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
2 changes: 1 addition & 1 deletion codegens/r-httr/test/unit/fixtures/sample_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
2 changes: 1 addition & 1 deletion codegens/r-rcurl/test/unit/fixtures/sample_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
30 changes: 30 additions & 0 deletions codegens/rust-reqwest/test/unit/validation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var expect = require('chai').expect,
path = require('path'),

package = require(path.resolve('.', 'package.json'));


describe('package.json', function () {
it('should have com_postman_plugin object with valid properties', function () {
expect(package).to.have.property('com_postman_plugin');

expect(package.com_postman_plugin.type).to.equal('code_generator');
expect(package.com_postman_plugin.lang).to.be.a('string');
expect(package.com_postman_plugin.variant).to.be.a('string');
expect(package.com_postman_plugin.syntax_mode).to.be.equal('rust');
});
it('should have main property with relative path to object with convert property', function () {
var languageModule;

expect(package.main).to.be.a('string');

try {
languageModule = require(path.resolve('.', package.main));
}
catch (error) {
console.error(error);
}
expect(languageModule).to.be.a('object');
expect(languageModule.convert).to.be.a('function');
});
});
2 changes: 1 addition & 1 deletion codegens/shell-httpie/examples/test-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down
16 changes: 8 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sdk = require('postman-collection'),
const sdk = require('postman-collection'),
labelList = require('./assets/languageLabels.json'),
languageMap = require('./assets/languages.js');

Expand All @@ -11,14 +11,14 @@ module.exports = {
* @param {Function} callback - callback function with arguments (error, object)
*/
getOptions (language, variant, callback) {
var validCodegen = languageMap.filter((codegen) => {
var lang = codegen.lang.trim(),
const validCodegen = languageMap.filter((codegen) => {
const lang = codegen.lang.trim(),
currentVariant = codegen.variant.trim();
return language === lang.toLowerCase() && variant.toLowerCase() === currentVariant.toLowerCase();
});

validCodegen.forEach((codegen) => {
main = codegen.main;
const main = codegen.main;
if (typeof main.getOptions !== 'function') {
return callback('Codegen~getOptions: getOptions is not a function');
}
Expand All @@ -35,10 +35,10 @@ module.exports = {
*
*/
getLanguageList () {
var langMap = {},
let langMap = {},
supportedLanguages = [];
languageMap.forEach((codegen) => {
var lang = codegen.lang.trim(),
let lang = codegen.lang.trim(),
syntax_mode = codegen.syntax_mode.trim(),
variant = codegen.variant.trim();
lang = lang.toLowerCase();
Expand Down Expand Up @@ -84,14 +84,14 @@ module.exports = {
* @param {Function} callback - callback function with arguments (error, string)
*/
convert (language, variant, request, options, callback) {
var convert, main;
let convert, main;

if (!sdk.Request.isRequest(request)) {
return callback('Codegen~convert: Invalid request');
}

languageMap.forEach((codegen) => {
var lang = codegen.lang.trim(),
const lang = codegen.lang.trim(),
currentVariant = codegen.variant.trim();
if (language.toLowerCase() === lang.toLowerCase() && variant.toLowerCase() === currentVariant.toLowerCase()) {
main = codegen.main;
Expand Down
6 changes: 3 additions & 3 deletions npm/ci-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pushd ./codegens/swift &>/dev/null;
sudo apt-get update
sudo apt-get install clang-3.6 libicu-dev libpython2.7 -y
sudo apt-get install libcurl4 libpython2.7-dev -y
sudo wget https://download.swift.org/swift-5.7.3-release/ubuntu2004/swift-5.7.3-RELEASE/swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
sudo wget -q https://download.swift.org/swift-5.7.3-release/ubuntu2004/swift-5.7.3-RELEASE/swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
sudo tar xzf swift-5.7.3-RELEASE-ubuntu20.04.tar.gz
sudo chmod 777 swift-5.7.3-RELEASE-ubuntu20.04/usr/lib/swift/CoreFoundation/module.map
popd &>/dev/null;
Expand All @@ -82,7 +82,7 @@ sudo apt-get install httpie

echo "Installing dependencies required for tests in codegens/dart"
pushd ./codegens/dart-http &>/dev/null;
wget https://storage.googleapis.com/dart-archive/channels/stable/release/2.10.2/linux_packages/dart_2.10.2-1_amd64.deb
wget -q https://storage.googleapis.com/dart-archive/channels/stable/release/2.10.2/linux_packages/dart_2.10.2-1_amd64.deb
sudo dpkg -i dart_2.10.2-1_amd64.deb
echo '''name: test
dependencies:
Expand All @@ -100,7 +100,7 @@ echo "Installing dependencies required for tests in codegens/php-guzzle"

echo "Installing dependencies required for tests in codegens/r-rCurl and r-httr Installing R"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial-cran40/'
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
sudo apt-get update
sudo apt-get install r-base

Expand Down
2 changes: 1 addition & 1 deletion test/codegen/newman/fixtures/unsupportedMethods.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"response": []
},
{
"name": "PROFIND request",
"name": "PROPFIND request",
"request": {
"method": "PROPFIND",
"header": [
Expand Down

0 comments on commit a5f455b

Please sign in to comment.