[JavaScript] fix index.js, ApiClient.js and test files generated to incorrect location (#2511)

remove outdated samples files
update test dependencies
This commit is contained in:
Vincent Devos
2019-03-30 03:04:44 +01:00
committed by William Cheng
parent c4d982f775
commit 8977d7b366
294 changed files with 3031 additions and 7681 deletions

View File

@@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
@@ -16,10 +16,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);
@@ -50,10 +50,10 @@
}
describe('AnotherFakeApi', function() {
describe('testSpecialTags', function() {
it('should call testSpecialTags successfully', function(done) {
//uncomment below and update the code to test testSpecialTags
//instance.testSpecialTags(function(error) {
describe('call123testSpecialTags', function() {
it('should call call123testSpecialTags successfully', function(done) {
//uncomment below and update the code to test call123testSpecialTags
//instance.call123testSpecialTags(function(error) {
// if (error) throw error;
//expect().to.be();
//});

View File

@@ -1,21 +1,36 @@
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenAPIPetstore);
factory(root.expect, root.OpenApiPetstore);
}
}(this, function(expect, OpenAPIPetstore) {
}(this, function(expect, OpenApiPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new OpenAPIPetstore.FakeApi();
instance = new OpenApiPetstore.FakeApi();
});
var getProperty = function(object, getter, property) {
@@ -35,10 +50,130 @@
}
describe('FakeApi', function() {
describe('createXmlItem', function() {
it('should call createXmlItem successfully', function(done) {
//uncomment below and update the code to test createXmlItem
//instance.createXmlItem(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeOuterBooleanSerialize', function() {
it('should call fakeOuterBooleanSerialize successfully', function(done) {
//uncomment below and update the code to test fakeOuterBooleanSerialize
//instance.fakeOuterBooleanSerialize(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeOuterCompositeSerialize', function() {
it('should call fakeOuterCompositeSerialize successfully', function(done) {
//uncomment below and update the code to test fakeOuterCompositeSerialize
//instance.fakeOuterCompositeSerialize(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeOuterNumberSerialize', function() {
it('should call fakeOuterNumberSerialize successfully', function(done) {
//uncomment below and update the code to test fakeOuterNumberSerialize
//instance.fakeOuterNumberSerialize(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('fakeOuterStringSerialize', function() {
it('should call fakeOuterStringSerialize successfully', function(done) {
//uncomment below and update the code to test fakeOuterStringSerialize
//instance.fakeOuterStringSerialize(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testBodyWithFileSchema', function() {
it('should call testBodyWithFileSchema successfully', function(done) {
//uncomment below and update the code to test testBodyWithFileSchema
//instance.testBodyWithFileSchema(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testBodyWithQueryParams', function() {
it('should call testBodyWithQueryParams successfully', function(done) {
//uncomment below and update the code to test testBodyWithQueryParams
//instance.testBodyWithQueryParams(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testClientModel', function() {
it('should call testClientModel successfully', function(done) {
//uncomment below and update the code to test testClientModel
//instance.testClientModel(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testEndpointParameters', function() {
it('should call testEndpointParameters successfully', function(done) {
//uncomment below and update the code to test testEndpointParameters
//instance.testEndpointParameters(pet, function(error) {
//instance.testEndpointParameters(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testEnumParameters', function() {
it('should call testEnumParameters successfully', function(done) {
//uncomment below and update the code to test testEnumParameters
//instance.testEnumParameters(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testGroupParameters', function() {
it('should call testGroupParameters successfully', function(done) {
//uncomment below and update the code to test testGroupParameters
//instance.testGroupParameters(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testInlineAdditionalProperties', function() {
it('should call testInlineAdditionalProperties successfully', function(done) {
//uncomment below and update the code to test testInlineAdditionalProperties
//instance.testInlineAdditionalProperties(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('testJsonFormData', function() {
it('should call testJsonFormData successfully', function(done) {
//uncomment below and update the code to test testJsonFormData
//instance.testJsonFormData(function(error) {
// if (error) throw error;
//expect().to.be();
//});

View File

@@ -7,7 +7,7 @@
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 3.0.0-SNAPSHOT
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
@@ -16,10 +16,10 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenApiPetstore);

View File

@@ -1,21 +1,36 @@
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenAPIPetstore);
factory(root.expect, root.OpenApiPetstore);
}
}(this, function(expect, OpenAPIPetstore) {
}(this, function(expect, OpenApiPetstore) {
'use strict';
var api;
var instance;
beforeEach(function() {
api = new OpenAPIPetstore.PetApi();
instance = new OpenApiPetstore.PetApi();
});
var getProperty = function(object, getter, property) {
@@ -34,79 +49,97 @@
object[property] = value;
}
var createRandomPet = function() {
var id = new Date().getTime();
var pet = new OpenAPIPetstore.Pet();
setProperty(pet, "setId", "id", id);
setProperty(pet, "setName", "name", "pet" + id);
var category = new OpenAPIPetstore.Category();
setProperty(category, "setId", "id", id);
setProperty(category, "setName", "name", "category" + id);
setProperty(pet, "setCategory", "category", category);
setProperty(pet, "setStatus", "status", "available");
var photos = ["http://foo.bar.com/1", "http://foo.bar.com/2"];
setProperty(pet, "setPhotoUrls", "photoUrls", photos);
return pet;
};
describe('PetApi', function() {
it('should create and get pet', function(done) {
var pet = createRandomPet();
api.addPet(pet, function(error) {
if (error) throw error;
api.getPetById(pet.id, function(error, fetched, response) {
if (error) throw error;
expect(response.status).to.be(200);
expect(response.ok).to.be(true);
expect(response.get('Content-Type')).to.be('application/json');
expect(fetched).to.be.a(OpenAPIPetstore.Pet);
expect(fetched.id).to.be(pet.id);
expect(getProperty(fetched, "getPhotoUrls", "photoUrls"))
.to.eql(getProperty(pet, "getPhotoUrls", "photoUrls"));
expect(getProperty(fetched, "getCategory", "category"))
.to.be.a(OpenAPIPetstore.Category);
expect(getProperty(getProperty(fetched, "getCategory", "category"), "getName", "name"))
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
api.deletePet(pet.id);
done();
});
describe('addPet', function() {
it('should call addPet successfully', function(done) {
//uncomment below and update the code to test addPet
//instance.addPet(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
/* commented out the following as the fake endpoint has been removed from the spec
* we'll add it back after updating the Petstore server
it('getPetByIdInObject', function(done) {
var pet = createRandomPet();
api.addPet({body: pet}, function(error) {
if (error) throw error;
api.getPetByIdInObject(pet.id, function(error, fetched) {
if (error) throw error;
expect(fetched).to.be.a(OpenAPIPetstore.InlineResponse200);
expect(fetched.id).to.be(pet.id);
expect(fetched.name).to.be(pet.name);
var categoryObj = fetched.category;
expect(categoryObj).to.be.a(Object);
expect(categoryObj).not.to.be.a(OpenAPIPetstore.Category);
expect(categoryObj.id)
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getId", "id"));
expect(categoryObj.name)
.to.be(getProperty(getProperty(pet, "getCategory", "category"), "getName", "name"));
api.deletePet(pet.id);
done();
});
describe('deletePet', function() {
it('should call deletePet successfully', function(done) {
//uncomment below and update the code to test deletePet
//instance.deletePet(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('findPetsByStatus', function() {
it('should call findPetsByStatus successfully', function(done) {
//uncomment below and update the code to test findPetsByStatus
//instance.findPetsByStatus(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('findPetsByTags', function() {
it('should call findPetsByTags successfully', function(done) {
//uncomment below and update the code to test findPetsByTags
//instance.findPetsByTags(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('getPetById', function() {
it('should call getPetById successfully', function(done) {
//uncomment below and update the code to test getPetById
//instance.getPetById(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('updatePet', function() {
it('should call updatePet successfully', function(done) {
//uncomment below and update the code to test updatePet
//instance.updatePet(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('updatePetWithForm', function() {
it('should call updatePetWithForm successfully', function(done) {
//uncomment below and update the code to test updatePetWithForm
//instance.updatePetWithForm(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('uploadFile', function() {
it('should call uploadFile successfully', function(done) {
//uncomment below and update the code to test uploadFile
//instance.uploadFile(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('uploadFileWithRequiredFile', function() {
it('should call uploadFileWithRequiredFile successfully', function(done) {
//uncomment below and update the code to test uploadFileWithRequiredFile
//instance.uploadFileWithRequiredFile(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
*/
});
}));

View File

@@ -1,45 +1,95 @@
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenAPIPetstore);
factory(root.expect, root.OpenApiPetstore);
}
}(this, function(expect, OpenAPIPetstore) {
}(this, function(expect, OpenApiPetstore) {
'use strict';
var api;
var instance;
beforeEach(function() {
api = new OpenAPIPetstore.StoreApi();
instance = new OpenApiPetstore.StoreApi();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('StoreApi', function() {
/* commented out the following as the fake endpoint has been removed from the spec
* we'll add it back after updating the petstore server
*
it('getInventoryInObject', function(done) {
api.getInventoryInObject(function(error, obj) {
if (error) throw error;
expect(obj).to.be.a(Object);
var hasKey = false;
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
hasKey = true;
expect(obj[key]).to.be.a('number');
}
}
expect(hasKey).to.be(true);
describe('deleteOrder', function() {
it('should call deleteOrder successfully', function(done) {
//uncomment below and update the code to test deleteOrder
//instance.deleteOrder(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('getInventory', function() {
it('should call getInventory successfully', function(done) {
//uncomment below and update the code to test getInventory
//instance.getInventory(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('getOrderById', function() {
it('should call getOrderById successfully', function(done) {
//uncomment below and update the code to test getOrderById
//instance.getOrderById(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('placeOrder', function() {
it('should call placeOrder successfully', function(done) {
//uncomment below and update the code to test placeOrder
//instance.placeOrder(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
*/
});
}));

View File

@@ -1,21 +1,36 @@
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* OpenAPI Generator version: 4.0.0-SNAPSHOT
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.OpenAPIPetstore);
factory(root.expect, root.OpenApiPetstore);
}
}(this, function(expect, OpenAPIPetstore) {
}(this, function(expect, OpenApiPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new OpenAPIPetstore.UserApi();
instance = new OpenApiPetstore.UserApi();
});
var getProperty = function(object, getter, property) {
@@ -38,7 +53,7 @@
describe('createUser', function() {
it('should call createUser successfully', function(done) {
//uncomment below and update the code to test createUser
//instance.createUser(pet, function(error) {
//instance.createUser(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -48,7 +63,7 @@
describe('createUsersWithArrayInput', function() {
it('should call createUsersWithArrayInput successfully', function(done) {
//uncomment below and update the code to test createUsersWithArrayInput
//instance.createUsersWithArrayInput(pet, function(error) {
//instance.createUsersWithArrayInput(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -58,7 +73,7 @@
describe('createUsersWithListInput', function() {
it('should call createUsersWithListInput successfully', function(done) {
//uncomment below and update the code to test createUsersWithListInput
//instance.createUsersWithListInput(pet, function(error) {
//instance.createUsersWithListInput(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -68,7 +83,7 @@
describe('deleteUser', function() {
it('should call deleteUser successfully', function(done) {
//uncomment below and update the code to test deleteUser
//instance.deleteUser(pet, function(error) {
//instance.deleteUser(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -78,7 +93,7 @@
describe('getUserByName', function() {
it('should call getUserByName successfully', function(done) {
//uncomment below and update the code to test getUserByName
//instance.getUserByName(pet, function(error) {
//instance.getUserByName(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -88,7 +103,7 @@
describe('loginUser', function() {
it('should call loginUser successfully', function(done) {
//uncomment below and update the code to test loginUser
//instance.loginUser(pet, function(error) {
//instance.loginUser(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -98,7 +113,7 @@
describe('logoutUser', function() {
it('should call logoutUser successfully', function(done) {
//uncomment below and update the code to test logoutUser
//instance.logoutUser(pet, function(error) {
//instance.logoutUser(function(error) {
// if (error) throw error;
//expect().to.be();
//});
@@ -108,7 +123,7 @@
describe('updateUser', function() {
it('should call updateUser successfully', function(done) {
//uncomment below and update the code to test updateUser
//instance.updateUser(pet, function(error) {
//instance.updateUser(function(error) {
// if (error) throw error;
//expect().to.be();
//});