Fix: Legacy tests resetting existing coverage (#351)
This commit is contained in:
Родитель
cd5cef5840
Коммит
08cba1c8ce
|
@ -0,0 +1,5 @@
|
|||
# Use unix line endings always, even on Windows
|
||||
* text=auto eol=lf
|
||||
|
||||
# Allow comments in JSON in GitHub rendering
|
||||
*.json linguist-language=JSON-with-Comments
|
588
legacy/app.js
588
legacy/app.js
|
@ -1,588 +0,0 @@
|
|||
var express = require("express");
|
||||
var path = require("path");
|
||||
var favicon = require("serve-favicon");
|
||||
var logger = require("morgan");
|
||||
var cookieParser = require("cookie-parser");
|
||||
var bodyParser = require("body-parser");
|
||||
var fs = require("fs");
|
||||
var morgan = require("morgan");
|
||||
var routes = require("./routes/index");
|
||||
var number = require("./routes/number");
|
||||
var array = require("./routes/array");
|
||||
var bool = require("./routes/bool");
|
||||
var integer = require("./routes/int");
|
||||
var string = require("./routes/string");
|
||||
var byte = require("./routes/byte");
|
||||
var date = require("./routes/date");
|
||||
var datetime = require("./routes/datetime");
|
||||
var datetimeRfc1123 = require("./routes/datetime-rfc1123");
|
||||
var duration = require("./routes/duration");
|
||||
var complex = require("./routes/complex");
|
||||
var report = require("./routes/report");
|
||||
var dictionary = require("./routes/dictionary");
|
||||
var paths = require("./routes/paths");
|
||||
var queries = require("./routes/queries");
|
||||
var pathitem = require("./routes/pathitem");
|
||||
var header = require("./routes/header");
|
||||
var reqopt = require("./routes/reqopt");
|
||||
var httpResponses = require("./routes/httpResponses");
|
||||
var files = require("./routes/files");
|
||||
var formData = require("./routes/formData");
|
||||
var lros = require("./routes/lros");
|
||||
var lroParameterizedEndpoints = require("./routes/lroParameterizedEndpoints.js");
|
||||
var paging = require("./routes/paging");
|
||||
var modelFlatten = require("./routes/model-flatten");
|
||||
var azureUrl = require("./routes/azureUrl");
|
||||
var azureSpecial = require("./routes/azureSpecials");
|
||||
var parameterGrouping = require("./routes/azureParameterGrouping.js");
|
||||
var validation = require("./routes/validation.js");
|
||||
var customUri = require("./routes/customUri.js");
|
||||
var extensibleEnums = require("./routes/extensibleEnums.js");
|
||||
var errorStatusCodes = require("./routes/errorStatusCodes.js");
|
||||
var additionalProperties = require("./routes/additionalProperties.js");
|
||||
var mediatypes = require("./routes/mediatypes");
|
||||
var multiapi = require("./routes/multiapi");
|
||||
var objectType = require("./routes/objectType.js");
|
||||
var nonStringEnums = require("./routes/nonStringEnums.js");
|
||||
var time = require("./routes/time.js");
|
||||
var multipleInheritance = require("./routes/multipleInheritance.js");
|
||||
var multiapiCustomBaseUrl = require("./routes/multiapiCustomBaseUrl.js");
|
||||
|
||||
var xml = require("./routes/xml.js"); // XML serialization
|
||||
var cors = require("cors");
|
||||
var app = express();
|
||||
|
||||
//set up server log
|
||||
var now = new Date();
|
||||
var logFileName = "AccTestServer-" + now.getHours() + now.getMinutes() + now.getSeconds() + ".log";
|
||||
var testResultDir = path.join(__dirname, "..", "TestResults");
|
||||
if (!fs.existsSync(testResultDir)) {
|
||||
fs.mkdirSync(testResultDir, { recursive: true });
|
||||
}
|
||||
var logfile = fs.createWriteStream(path.join(testResultDir, logFileName), { flags: "a" });
|
||||
app.use(morgan("combined", { stream: logfile }));
|
||||
|
||||
// allow CORS for browser tests
|
||||
app.use(
|
||||
cors({
|
||||
origin: /localhost:\d+/,
|
||||
credentials: true,
|
||||
exposedHeaders: [
|
||||
"x-ms-request-id",
|
||||
"foo-request-id",
|
||||
"Content-Type",
|
||||
"value",
|
||||
"Location",
|
||||
"Azure-AsyncOperation",
|
||||
"Retry-After",
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
var azurecoverage = {};
|
||||
var optionalCoverage = {
|
||||
getDecimalInvalid: 0,
|
||||
getDecimalBig: 0,
|
||||
getDecimalSmall: 0,
|
||||
getDecimalBigPositiveDecimal: 0,
|
||||
getDecimalBigNegativeDecimal: 0,
|
||||
putDecimalBig: 0,
|
||||
putDecimalSmall: 0,
|
||||
putDecimalBigPositiveDecimal: 0,
|
||||
putDecimalBigNegativeDecimal: 0,
|
||||
};
|
||||
var coverage = {
|
||||
additionalPropertiesTrue: 0,
|
||||
additionalPropertiesSubclass: 0,
|
||||
additionalPropertiesTypeObject: 0,
|
||||
additionalPropertiesTypeString: 0,
|
||||
additionalPropertiesInProperties: 0,
|
||||
additionalPropertiesInPropertiesWithAPTypeString: 0,
|
||||
getArrayNull: 0,
|
||||
getArrayEmpty: 0,
|
||||
putArrayEmpty: 0,
|
||||
getArrayInvalid: 0,
|
||||
getArrayBooleanValid: 0,
|
||||
putArrayBooleanValid: 0,
|
||||
getArrayBooleanWithNull: 0,
|
||||
getArrayBooleanWithString: 0,
|
||||
getArrayIntegerValid: 0,
|
||||
putArrayIntegerValid: 0,
|
||||
getArrayIntegerWithNull: 0,
|
||||
getArrayIntegerWithString: 0,
|
||||
getArrayLongValid: 0,
|
||||
putArrayLongValid: 0,
|
||||
getArrayLongWithNull: 0,
|
||||
getArrayLongWithString: 0,
|
||||
getArrayFloatValid: 0,
|
||||
putArrayFloatValid: 0,
|
||||
getArrayFloatWithNull: 0,
|
||||
getArrayFloatWithString: 0,
|
||||
getArrayDoubleValid: 0,
|
||||
putArrayDoubleValid: 0,
|
||||
getArrayDoubleWithNull: 0,
|
||||
getArrayDoubleWithString: 0,
|
||||
getArrayStringValid: 0,
|
||||
putArrayStringValid: 0,
|
||||
getArrayEnumValid: 0,
|
||||
putArrayEnumValid: 0,
|
||||
getArrayStringEnumValid: 0,
|
||||
putArrayStringEnumValid: 0,
|
||||
getArrayStringWithNull: 0,
|
||||
getArrayStringWithNumber: 0,
|
||||
getArrayDateValid: 0,
|
||||
putArrayDateValid: 0,
|
||||
getArrayDateWithNull: 0,
|
||||
getArrayDateWithInvalidChars: 0,
|
||||
getArrayDateTimeValid: 0,
|
||||
putArrayDateTimeValid: 0,
|
||||
getArrayDateTimeWithNull: 0,
|
||||
getArrayDateTimeWithInvalidChars: 0,
|
||||
getArrayDateTimeRfc1123Valid: 0,
|
||||
putArrayDateTimeRfc1123Valid: 0,
|
||||
getArrayDurationValid: 0,
|
||||
putArrayDurationValid: 0,
|
||||
getArrayUuidValid: 0,
|
||||
getArrayUuidWithInvalidChars: 0,
|
||||
putArrayUuidValid: 0,
|
||||
getArrayByteValid: 0,
|
||||
putArrayByteValid: 0,
|
||||
getArrayByteWithNull: 0,
|
||||
getArrayArrayNull: 0,
|
||||
getArrayArrayEmpty: 0,
|
||||
getArrayArrayItemNull: 0,
|
||||
getArrayArrayItemEmpty: 0,
|
||||
getArrayArrayValid: 0,
|
||||
putArrayArrayValid: 0,
|
||||
getArrayComplexNull: 0,
|
||||
getArrayComplexEmpty: 0,
|
||||
getArrayComplexItemNull: 0,
|
||||
getArrayComplexItemEmpty: 0,
|
||||
getArrayComplexValid: 0,
|
||||
putArrayComplexValid: 0,
|
||||
getArrayDictionaryNull: 0,
|
||||
getArrayDictionaryEmpty: 0,
|
||||
getArrayDictionaryItemNull: 0,
|
||||
getArrayDictionaryItemEmpty: 0,
|
||||
getArrayDictionaryValid: 0,
|
||||
putArrayDictionaryValid: 0,
|
||||
getBoolTrue: 0,
|
||||
putBoolTrue: 0,
|
||||
getBoolFalse: 0,
|
||||
putBoolFalse: 0,
|
||||
getBoolInvalid: 0,
|
||||
getBoolNull: 0,
|
||||
getByteNull: 0,
|
||||
getByteEmpty: 0,
|
||||
getByteNonAscii: 0,
|
||||
putByteNonAscii: 0,
|
||||
getByteInvalid: 0,
|
||||
getDateNull: 0,
|
||||
getDateInvalid: 0,
|
||||
getDateOverflow: 0,
|
||||
getDateUnderflow: 0,
|
||||
getDateMax: 0,
|
||||
putDateMax: 0,
|
||||
getDateMin: 0,
|
||||
putDateMin: 0,
|
||||
getDateTimeNull: 0,
|
||||
getDateTimeInvalid: 0,
|
||||
getDateTimeOverflow: 0,
|
||||
getDateTimeUnderflow: 0,
|
||||
putDateTimeMaxUtc: 0,
|
||||
getDateTimeMaxUtcLowercase: 0,
|
||||
getDateTimeMaxUtcUppercase: 0,
|
||||
getDateTimeMaxLocalPositiveOffsetLowercase: 0,
|
||||
getDateTimeMaxLocalPositiveOffsetUppercase: 0,
|
||||
getDateTimeMaxLocalNegativeOffsetLowercase: 0,
|
||||
getDateTimeMaxLocalNegativeOffsetUppercase: 0,
|
||||
getDateTimeMinUtc: 0,
|
||||
putDateTimeMinUtc: 0,
|
||||
getDateTimeMinLocalPositiveOffset: 0,
|
||||
getDateTimeMinLocalNegativeOffset: 0,
|
||||
getDateTimeRfc1123Null: 0,
|
||||
getDateTimeRfc1123Invalid: 0,
|
||||
getDateTimeRfc1123Overflow: 0,
|
||||
getDateTimeRfc1123Underflow: 0,
|
||||
getDateTimeRfc1123MinUtc: 0,
|
||||
putDateTimeRfc1123Max: 0,
|
||||
putDateTimeRfc1123Min: 0,
|
||||
getDateTimeRfc1123MaxUtcLowercase: 0,
|
||||
getDateTimeRfc1123MaxUtcUppercase: 0,
|
||||
getIntegerNull: 0,
|
||||
getIntegerInvalid: 0,
|
||||
getIntegerOverflow: 0,
|
||||
getIntegerUnderflow: 0,
|
||||
getLongOverflow: 0,
|
||||
getLongUnderflow: 0,
|
||||
putIntegerMax: 0,
|
||||
putLongMax: 0,
|
||||
putIntegerMin: 0,
|
||||
putLongMin: 0,
|
||||
getNumberNull: 0,
|
||||
getFloatInvalid: 0,
|
||||
getDoubleInvalid: 0,
|
||||
getFloatBigScientificNotation: 0,
|
||||
putFloatBigScientificNotation: 0,
|
||||
getDoubleBigScientificNotation: 0,
|
||||
putDoubleBigScientificNotation: 0,
|
||||
getDoubleBigPositiveDecimal: 0,
|
||||
putDoubleBigPositiveDecimal: 0,
|
||||
getDoubleBigNegativeDecimal: 0,
|
||||
putDoubleBigNegativeDecimal: 0,
|
||||
getFloatSmallScientificNotation: 0,
|
||||
putFloatSmallScientificNotation: 0,
|
||||
getDoubleSmallScientificNotation: 0,
|
||||
putDoubleSmallScientificNotation: 0,
|
||||
getStringNull: 0,
|
||||
putStringNull: 0,
|
||||
getStringEmpty: 0,
|
||||
putStringEmpty: 0,
|
||||
getStringMultiByteCharacters: 0,
|
||||
putStringMultiByteCharacters: 0,
|
||||
getStringWithLeadingAndTrailingWhitespace: 0,
|
||||
putStringWithLeadingAndTrailingWhitespace: 0,
|
||||
getStringNotProvided: 0,
|
||||
getEnumNotExpandable: 0,
|
||||
putEnumNotExpandable: 0,
|
||||
putComplexBasicValid: 0,
|
||||
getComplexBasicValid: 0,
|
||||
getComplexBasicEmpty: 0,
|
||||
getComplexBasicNotProvided: 0,
|
||||
getComplexBasicNull: 0,
|
||||
getComplexBasicInvalid: 0,
|
||||
putComplexPrimitiveInteger: 0,
|
||||
putComplexPrimitiveLong: 0,
|
||||
putComplexPrimitiveFloat: 0,
|
||||
putComplexPrimitiveDouble: 0,
|
||||
putComplexPrimitiveBool: 0,
|
||||
putComplexPrimitiveString: 0,
|
||||
putComplexPrimitiveDate: 0,
|
||||
putComplexPrimitiveDateTime: 0,
|
||||
putComplexPrimitiveDateTimeRfc1123: 0,
|
||||
putComplexPrimitiveDuration: 0,
|
||||
putComplexPrimitiveByte: 0,
|
||||
getComplexPrimitiveInteger: 0,
|
||||
getComplexPrimitiveLong: 0,
|
||||
getComplexPrimitiveFloat: 0,
|
||||
getComplexPrimitiveDouble: 0,
|
||||
getComplexPrimitiveBool: 0,
|
||||
getComplexPrimitiveString: 0,
|
||||
getComplexPrimitiveDate: 0,
|
||||
getComplexPrimitiveDateTime: 0,
|
||||
getComplexPrimitiveDateTimeRfc1123: 0,
|
||||
getComplexPrimitiveDuration: 0,
|
||||
getComplexPrimitiveByte: 0,
|
||||
putComplexArrayValid: 0,
|
||||
putComplexArrayEmpty: 0,
|
||||
getComplexArrayValid: 0,
|
||||
getComplexArrayEmpty: 0,
|
||||
getComplexArrayNotProvided: 0,
|
||||
putComplexDictionaryValid: 0,
|
||||
putComplexDictionaryEmpty: 0,
|
||||
getComplexDictionaryValid: 0,
|
||||
getComplexDictionaryEmpty: 0,
|
||||
getComplexDictionaryNull: 0,
|
||||
getComplexDictionaryNotProvided: 0,
|
||||
putComplexInheritanceValid: 0,
|
||||
getComplexInheritanceValid: 0,
|
||||
putComplexPolymorphismValid: 0,
|
||||
getComplexPolymorphismValid: 0,
|
||||
putComplexPolymorphismComplicated: 0,
|
||||
getComplexPolymorphismComplicated: 0,
|
||||
putComplexPolymorphismNoDiscriminator: 0,
|
||||
putComplexPolymorphicRecursiveValid: 0,
|
||||
getComplexPolymorphicRecursiveValid: 0,
|
||||
putComplexReadOnlyPropertyValid: 0,
|
||||
getComplexReadOnlyPropertyValid: 0,
|
||||
UrlPathsBoolFalse: 0,
|
||||
UrlPathsBoolTrue: 0,
|
||||
UrlPathsIntPositive: 0,
|
||||
UrlPathsIntNegative: 0,
|
||||
UrlPathsLongPositive: 0,
|
||||
UrlPathsLongNegative: 0,
|
||||
UrlPathsFloatPositive: 0,
|
||||
UrlPathsFloatNegative: 0,
|
||||
UrlPathsDoublePositive: 0,
|
||||
UrlPathsDoubleNegative: 0,
|
||||
UrlPathsStringUrlEncoded: 0,
|
||||
UrlPathsStringUrlNonEncoded: 0,
|
||||
UrlPathsStringEmpty: 0,
|
||||
UrlPathsStringUnicode: 0,
|
||||
UrlPathsEnumValid: 0,
|
||||
UrlPathsByteMultiByte: 0,
|
||||
UrlPathsByteEmpty: 0,
|
||||
UrlPathsDateValid: 0,
|
||||
UrlPathsDateTimeValid: 0,
|
||||
UrlQueriesBoolFalse: 0,
|
||||
UrlQueriesBoolTrue: 0,
|
||||
UrlQueriesBoolNull: 0,
|
||||
UrlQueriesIntPositive: 0,
|
||||
UrlQueriesIntNegative: 0,
|
||||
UrlQueriesIntNull: 0,
|
||||
UrlQueriesLongPositive: 0,
|
||||
UrlQueriesLongNegative: 0,
|
||||
UrlQueriesLongNull: 0,
|
||||
UrlQueriesFloatPositive: 0,
|
||||
UrlQueriesFloatNegative: 0,
|
||||
UrlQueriesFloatNull: 0,
|
||||
UrlQueriesDoublePositive: 0,
|
||||
UrlQueriesDoubleNegative: 0,
|
||||
UrlQueriesDoubleNull: 0,
|
||||
UrlQueriesStringUrlEncoded: 0,
|
||||
UrlQueriesStringEmpty: 0,
|
||||
UrlQueriesStringNull: 0,
|
||||
UrlQueriesStringUnicode: 0,
|
||||
UrlQueriesEnumValid: 0,
|
||||
UrlQueriesEnumNull: 0,
|
||||
UrlQueriesByteMultiByte: 0,
|
||||
UrlQueriesByteEmpty: 0,
|
||||
UrlQueriesByteNull: 0,
|
||||
UrlQueriesDateValid: 0,
|
||||
UrlQueriesDateNull: 0,
|
||||
UrlQueriesDateTimeValid: 0,
|
||||
UrlQueriesDateTimeNull: 0,
|
||||
UrlQueriesArrayCsvNull: 0,
|
||||
UrlQueriesArrayCsvEmpty: 0,
|
||||
UrlQueriesArrayCsvValid: 0,
|
||||
UrlQueriesArrayMultiNull: 0,
|
||||
UrlQueriesArrayMultiEmpty: 0,
|
||||
UrlQueriesArrayMultiValid: 0,
|
||||
UrlQueriesArraySsvValid: 0,
|
||||
UrlQueriesArrayPipesValid: 0,
|
||||
UrlQueriesArrayTsvValid: 0,
|
||||
UrlQueriesArrayNoCollectionFormatValid: 0,
|
||||
UrlPathItemGetAll: 0,
|
||||
UrlPathItemGetGlobalNull: 0,
|
||||
UrlPathItemGetGlobalAndLocalNull: 0,
|
||||
UrlPathItemGetPathItemAndLocalNull: 0,
|
||||
putDictionaryEmpty: 0,
|
||||
getDictionaryNull: 0,
|
||||
getDictionaryEmpty: 0,
|
||||
getDictionaryInvalid: 0,
|
||||
getDictionaryNullValue: 0,
|
||||
getDictionaryNullkey: 0,
|
||||
getDictionaryKeyEmptyString: 0,
|
||||
getDictionaryBooleanValid: 0,
|
||||
getDictionaryBooleanWithNull: 0,
|
||||
getDictionaryBooleanWithString: 0,
|
||||
getDictionaryIntegerValid: 0,
|
||||
getDictionaryIntegerWithNull: 0,
|
||||
getDictionaryIntegerWithString: 0,
|
||||
getDictionaryLongValid: 0,
|
||||
getDictionaryLongWithNull: 0,
|
||||
getDictionaryLongWithString: 0,
|
||||
getDictionaryFloatValid: 0,
|
||||
getDictionaryFloatWithNull: 0,
|
||||
getDictionaryFloatWithString: 0,
|
||||
getDictionaryDoubleValid: 0,
|
||||
getDictionaryDoubleWithNull: 0,
|
||||
getDictionaryDoubleWithString: 0,
|
||||
getDictionaryStringValid: 0,
|
||||
getDictionaryStringWithNull: 0,
|
||||
getDictionaryStringWithNumber: 0,
|
||||
getDictionaryDateValid: 0,
|
||||
getDictionaryDateWithNull: 0,
|
||||
getDictionaryDateWithInvalidChars: 0,
|
||||
getDictionaryDateTimeValid: 0,
|
||||
getDictionaryDateTimeWithNull: 0,
|
||||
getDictionaryDateTimeWithInvalidChars: 0,
|
||||
getDictionaryDateTimeRfc1123Valid: 0,
|
||||
getDictionaryDurationValid: 0,
|
||||
getDictionaryByteValid: 0,
|
||||
getDictionaryByteWithNull: 0,
|
||||
putDictionaryBooleanValid: 0,
|
||||
putDictionaryIntegerValid: 0,
|
||||
putDictionaryLongValid: 0,
|
||||
putDictionaryFloatValid: 0,
|
||||
putDictionaryDoubleValid: 0,
|
||||
putDictionaryStringValid: 0,
|
||||
putDictionaryDateValid: 0,
|
||||
putDictionaryDateTimeValid: 0,
|
||||
putDictionaryDateTimeRfc1123Valid: 0,
|
||||
putDictionaryDurationValid: 0,
|
||||
putDictionaryByteValid: 0,
|
||||
getDictionaryComplexNull: 0,
|
||||
getDictionaryComplexEmpty: 0,
|
||||
getDictionaryComplexItemNull: 0,
|
||||
getDictionaryComplexItemEmpty: 0,
|
||||
getDictionaryComplexValid: 0,
|
||||
putDictionaryComplexValid: 0,
|
||||
getDictionaryArrayNull: 0,
|
||||
getDictionaryArrayEmpty: 0,
|
||||
getDictionaryArrayItemNull: 0,
|
||||
getDictionaryArrayItemEmpty: 0,
|
||||
getDictionaryArrayValid: 0,
|
||||
putDictionaryArrayValid: 0,
|
||||
getDictionaryDictionaryNull: 0,
|
||||
getDictionaryDictionaryEmpty: 0,
|
||||
getDictionaryDictionaryItemNull: 0,
|
||||
getDictionaryDictionaryItemEmpty: 0,
|
||||
getDictionaryDictionaryValid: 0,
|
||||
putDictionaryDictionaryValid: 0,
|
||||
putDurationPositive: 0,
|
||||
getDurationNull: 0,
|
||||
getDurationInvalid: 0,
|
||||
getDurationPositive: 0,
|
||||
HeaderParameterExistingKey: 0,
|
||||
HeaderResponseExistingKey: 0,
|
||||
HeaderResponseProtectedKey: 0,
|
||||
HeaderParameterIntegerPositive: 0,
|
||||
HeaderParameterIntegerNegative: 0,
|
||||
HeaderParameterLongPositive: 0,
|
||||
HeaderParameterLongNegative: 0,
|
||||
HeaderParameterFloatPositive: 0,
|
||||
HeaderParameterFloatNegative: 0,
|
||||
HeaderParameterDoublePositive: 0,
|
||||
HeaderParameterDoubleNegative: 0,
|
||||
HeaderParameterBoolTrue: 0,
|
||||
HeaderParameterBoolFalse: 0,
|
||||
HeaderParameterStringValid: 0,
|
||||
HeaderParameterStringNull: 0,
|
||||
HeaderParameterStringEmpty: 0,
|
||||
HeaderParameterDateValid: 0,
|
||||
HeaderParameterDateMin: 0,
|
||||
HeaderParameterDateTimeValid: 0,
|
||||
HeaderParameterDateTimeMin: 0,
|
||||
HeaderParameterDateTimeRfc1123Valid: 0,
|
||||
HeaderParameterDateTimeRfc1123Min: 0,
|
||||
HeaderParameterBytesValid: 0,
|
||||
HeaderParameterDurationValid: 0,
|
||||
HeaderResponseIntegerPositive: 0,
|
||||
HeaderResponseIntegerNegative: 0,
|
||||
HeaderResponseLongPositive: 0,
|
||||
HeaderResponseLongNegative: 0,
|
||||
HeaderResponseFloatPositive: 0,
|
||||
HeaderResponseFloatNegative: 0,
|
||||
HeaderResponseDoublePositive: 0,
|
||||
HeaderResponseDoubleNegative: 0,
|
||||
HeaderResponseBoolTrue: 0,
|
||||
HeaderResponseBoolFalse: 0,
|
||||
HeaderResponseStringValid: 0,
|
||||
HeaderResponseStringNull: 0,
|
||||
HeaderResponseStringEmpty: 0,
|
||||
HeaderParameterEnumValid: 0,
|
||||
HeaderParameterEnumNull: 0,
|
||||
HeaderResponseEnumValid: 0,
|
||||
HeaderResponseEnumNull: 0,
|
||||
HeaderResponseDateValid: 0,
|
||||
HeaderResponseDateMin: 0,
|
||||
HeaderResponseDateTimeValid: 0,
|
||||
HeaderResponseDateTimeMin: 0,
|
||||
HeaderResponseDateTimeRfc1123Valid: 0,
|
||||
HeaderResponseDateTimeRfc1123Min: 0,
|
||||
HeaderResponseBytesValid: 0,
|
||||
HeaderResponseDurationValid: 0,
|
||||
ConstantsInPath: 0,
|
||||
ConstantsInBody: 0,
|
||||
CustomBaseUri: 0,
|
||||
CustomBaseUriMoreOptions: 0,
|
||||
getModelFlattenArray: 0,
|
||||
putModelFlattenArray: 0,
|
||||
getModelFlattenDictionary: 0,
|
||||
putModelFlattenDictionary: 0,
|
||||
getModelFlattenResourceCollection: 0,
|
||||
putModelFlattenResourceCollection: 0,
|
||||
putModelFlattenCustomBase: 0,
|
||||
postModelFlattenCustomParameter: 0,
|
||||
putModelFlattenCustomGroupedParameter: 0,
|
||||
getStringBase64Encoded: 0,
|
||||
getStringBase64UrlEncoded: 0,
|
||||
putStringBase64UrlEncoded: 0,
|
||||
getStringNullBase64UrlEncoding: 0,
|
||||
getArrayBase64Url: 0,
|
||||
getDictionaryBase64Url: 0,
|
||||
UrlPathsStringBase64Url: 0,
|
||||
UrlPathsArrayCSVInPath: 0,
|
||||
getUnixTime: 0,
|
||||
getInvalidUnixTime: 0,
|
||||
getNullUnixTime: 0,
|
||||
putUnixTime: 0,
|
||||
UrlPathsIntUnixTime: 0,
|
||||
expectedEnum: 0,
|
||||
unexpectedEnum: 0,
|
||||
allowedValueEnum: 0,
|
||||
roundTripEnum: 0,
|
||||
getEnumReferenced: 0,
|
||||
putEnumReferenced: 0,
|
||||
getEnumReferencedConstant: 0,
|
||||
putEnumReferencedConstant: 0,
|
||||
expectedNoErrors: 0,
|
||||
expectedPetSadError: 0,
|
||||
expectedPetHungryError: 0,
|
||||
intError: 0,
|
||||
stringError: 0,
|
||||
animalNotFoundError: 0,
|
||||
linkNotFoundError: 0,
|
||||
};
|
||||
|
||||
// view engine setup
|
||||
app.set("views", path.join(__dirname, "views"));
|
||||
app.set("view engine", "pug");
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
app.use(logger("dev"));
|
||||
app.use(bodyParser.text({ type: "*/pdf" })); // Technically, PDF is not text, but that simplifies tests
|
||||
app.use(bodyParser.json({ strict: false }));
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, "public")));
|
||||
app.use("/__files", express.static(path.join(__dirname, "..", "__files")));
|
||||
|
||||
app.use("/", routes);
|
||||
app.use("/bool", new bool(coverage).router);
|
||||
app.use("/int", new integer(coverage).router);
|
||||
app.use("/number", new number(coverage, optionalCoverage).router);
|
||||
app.use("/string", new string(coverage).router);
|
||||
app.use("/byte", new byte(coverage).router);
|
||||
app.use("/date", new date(coverage).router);
|
||||
app.use("/datetime", new datetime(coverage, optionalCoverage).router);
|
||||
app.use("/datetimeRfc1123", new datetimeRfc1123(coverage).router);
|
||||
app.use("/duration", new duration(coverage, optionalCoverage).router);
|
||||
app.use("/array", new array(coverage).router);
|
||||
app.use("/complex", new complex(coverage).router);
|
||||
app.use("/dictionary", new dictionary(coverage).router);
|
||||
app.use("/paths", new paths(coverage).router);
|
||||
app.use("/queries", new queries(coverage).router);
|
||||
app.use("/pathitem", new pathitem(coverage).router);
|
||||
app.use("/header", new header(coverage, optionalCoverage).router);
|
||||
app.use("/reqopt", new reqopt(coverage).router);
|
||||
app.use("/files", new files(coverage).router);
|
||||
app.use("/formdata", new formData(optionalCoverage).router);
|
||||
app.use("/http", new httpResponses(coverage, optionalCoverage).router);
|
||||
app.use("/model-flatten", new modelFlatten(coverage).router);
|
||||
app.use("/lro", new lros(azurecoverage).router);
|
||||
app.use("/lroParameterizedEndpoints", new lroParameterizedEndpoints(azurecoverage).router);
|
||||
app.use("/paging", new paging(azurecoverage).router);
|
||||
app.use("/azurespecials", new azureSpecial(azurecoverage).router);
|
||||
app.use("/report", new report(coverage, azurecoverage, optionalCoverage).router);
|
||||
app.use("/subscriptions", new azureUrl(azurecoverage).router);
|
||||
app.use("/parameterGrouping", new parameterGrouping(azurecoverage).router);
|
||||
app.use("/validation", new validation(coverage).router);
|
||||
app.use("/customUri", new customUri(coverage).router);
|
||||
app.use("/extensibleEnums", new extensibleEnums(coverage).router);
|
||||
app.use("/errorStatusCodes", new errorStatusCodes(coverage, optionalCoverage).router);
|
||||
app.use("/additionalProperties", new additionalProperties(coverage).router);
|
||||
app.use("/mediatypes", new mediatypes(coverage).router);
|
||||
app.use("/xml", new xml(coverage).router);
|
||||
app.use("/multiapi", new multiapi(optionalCoverage).router);
|
||||
app.use("/objectType", new objectType(coverage).router);
|
||||
app.use("/nonStringEnums", new nonStringEnums(coverage).router);
|
||||
app.use("/time", new time(coverage).router);
|
||||
app.use("/multipleInheritance", new multipleInheritance(coverage).router);
|
||||
app.use("/multiapiCustomBaseUrl", new multiapiCustomBaseUrl(optionalCoverage).router);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
var err = new Error("Not Found");
|
||||
err.status = 404;
|
||||
next(err);
|
||||
});
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
res.status(err.status || 500);
|
||||
res.end(JSON.stringify(err));
|
||||
});
|
||||
|
||||
module.exports = app;
|
|
@ -1,154 +0,0 @@
|
|||
var express = require("express");
|
||||
var router = express.Router();
|
||||
var util = require("util");
|
||||
var constants = require("../util/constants");
|
||||
var utils = require("../util/utils");
|
||||
|
||||
var string = function (coverage) {
|
||||
var base64String = "YSBzdHJpbmcgdGhhdCBnZXRzIGVuY29kZWQgd2l0aCBiYXNlNjQ=";
|
||||
var base64UrlString = "YSBzdHJpbmcgdGhhdCBnZXRzIGVuY29kZWQgd2l0aCBiYXNlNjR1cmw";
|
||||
var RefColorConstant = { field1: "Sample String" };
|
||||
|
||||
router.put("/:scenario", function (req, res, next) {
|
||||
if (req.params.scenario === "null") {
|
||||
if (
|
||||
req.body === undefined ||
|
||||
(req.body && Object.keys(req.body).length === 0 && req.headers["content-length"] === "0")
|
||||
) {
|
||||
coverage["putStringNull"]++;
|
||||
res.status(200).end();
|
||||
} else {
|
||||
utils.send400(res, next, "Did not like null req '" + util.inspect(req) + "'");
|
||||
}
|
||||
} else if (req.params.scenario === "empty") {
|
||||
if (req.body !== "") {
|
||||
utils.send400(res, next, "Did not like empty req '" + util.inspect(req.body) + "'");
|
||||
} else {
|
||||
coverage["putStringEmpty"]++;
|
||||
res.status(200).end();
|
||||
}
|
||||
} else if (req.params.scenario === "mbcs") {
|
||||
if (req.body !== constants.MULTIBYTE_BUFFER_BODY) {
|
||||
utils.send400(res, next, "Did not like mbcs req '" + util.inspect(req.body) + "'");
|
||||
} else {
|
||||
coverage["putStringMultiByteCharacters"]++;
|
||||
res.status(200).end();
|
||||
}
|
||||
} else if (req.params.scenario === "whitespace") {
|
||||
if (req.body !== " Now is the time for all good men to come to the aid of their country ") {
|
||||
utils.send400(res, next, "Did not like whitespace req '" + util.inspect(req.body) + "'");
|
||||
} else {
|
||||
coverage["putStringWithLeadingAndTrailingWhitespace"]++;
|
||||
res.status(200).end();
|
||||
}
|
||||
} else if (req.params.scenario === "base64UrlEncoding") {
|
||||
if (req.body !== "YSBzdHJpbmcgdGhhdCBnZXRzIGVuY29kZWQgd2l0aCBiYXNlNjR1cmw") {
|
||||
utils.send400(res, next, "Did not like base64url req '" + util.inspect(req.body) + "'");
|
||||
} else {
|
||||
coverage["putStringBase64UrlEncoded"]++;
|
||||
res.status(200).end();
|
||||
}
|
||||
} else {
|
||||
utils.send400(res, next, "Request path must contain true or false");
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/:scenario", function (req, res, next) {
|
||||
if (req.params.scenario === "null") {
|
||||
coverage["getStringNull"]++;
|
||||
res.status(200).end();
|
||||
} else if (req.params.scenario === "base64Encoding") {
|
||||
coverage["getStringBase64Encoded"]++;
|
||||
res
|
||||
.status(200)
|
||||
.type("json")
|
||||
.end('"' + base64String + '"');
|
||||
} else if (req.params.scenario === "base64UrlEncoding") {
|
||||
coverage["getStringBase64UrlEncoded"]++;
|
||||
res
|
||||
.status(200)
|
||||
.type("json")
|
||||
.end('"' + base64UrlString + '"');
|
||||
} else if (req.params.scenario === "nullBase64UrlEncoding") {
|
||||
coverage["getStringNullBase64UrlEncoding"]++;
|
||||
res.status(200).end();
|
||||
} else if (req.params.scenario === "notProvided") {
|
||||
coverage["getStringNotProvided"]++;
|
||||
res.status(200).end();
|
||||
} else if (req.params.scenario === "empty") {
|
||||
coverage["getStringEmpty"]++;
|
||||
res.status(200).type("json").end('""');
|
||||
} else if (req.params.scenario === "mbcs") {
|
||||
coverage["getStringMultiByteCharacters"]++;
|
||||
res
|
||||
.status(200)
|
||||
.type("json")
|
||||
.end('"' + constants.MULTIBYTE_BUFFER_BODY + '"');
|
||||
} else if (req.params.scenario === "whitespace") {
|
||||
coverage["getStringWithLeadingAndTrailingWhitespace"]++;
|
||||
res
|
||||
.status(200)
|
||||
.type("json")
|
||||
.end('" Now is the time for all good men to come to the aid of their country "');
|
||||
} else {
|
||||
res.status(400).end("Request path must contain null or empty or mbcs or whitespace");
|
||||
}
|
||||
});
|
||||
|
||||
router.get("/enum/notExpandable", function (req, res, next) {
|
||||
coverage["getEnumNotExpandable"]++;
|
||||
res.status(200).type("json").end('"red color"');
|
||||
});
|
||||
|
||||
router.put("/enum/notExpandable", function (req, res, next) {
|
||||
if (req.body === "red color") {
|
||||
coverage["putEnumNotExpandable"]++;
|
||||
res.status(200).end();
|
||||
} else {
|
||||
utils.send400(res, next, "Did not like enum in the req '" + util.inspect(req.body) + "'");
|
||||
}
|
||||
});
|
||||
router.get("/enum/notExpandable", function (req, res, next) {
|
||||
coverage["getEnumNotExpandable"]++;
|
||||
res.status(200).type("json").end('"red color"');
|
||||
});
|
||||
|
||||
router.put("/enum/notExpandable", function (req, res, next) {
|
||||
if (req.body === "red color") {
|
||||
coverage["putEnumNotExpandable"]++;
|
||||
res.status(200).end();
|
||||
} else {
|
||||
utils.send400(res, next, "Did not like enum in the req '" + util.inspect(req.body) + "'");
|
||||
}
|
||||
});
|
||||
router.get("/enum/Referenced", function (req, res, next) {
|
||||
coverage["getEnumReferenced"]++;
|
||||
res.status(200).type("json").end('"red color"');
|
||||
});
|
||||
|
||||
router.put("/enum/Referenced", function (req, res, next) {
|
||||
if (req.body === "red color") {
|
||||
coverage["putEnumReferenced"]++;
|
||||
res.status(200).end();
|
||||
} else {
|
||||
utils.send400(res, next, "Did not like enum in the req '" + util.inspect(req.body) + "'");
|
||||
}
|
||||
});
|
||||
router.get("/enum/ReferencedConstant", function (req, res, next) {
|
||||
coverage["getEnumReferencedConstant"]++;
|
||||
res.status(200).json(RefColorConstant);
|
||||
});
|
||||
|
||||
router.put("/enum/ReferencedConstant", function (req, res, next) {
|
||||
if (req.body.ColorConstant === "green-color") {
|
||||
coverage["putEnumReferencedConstant"]++;
|
||||
res.status(200).end();
|
||||
} else {
|
||||
utils.send400(res, next, "Did not like constant in the req '" + util.inspect(req.body) + "'");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
string.prototype.router = router;
|
||||
|
||||
module.exports = string;
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@microsoft.azure/autorest.testserver",
|
||||
"version": "3.3.2",
|
||||
"version": "3.3.3",
|
||||
"description": "Autorest test server.",
|
||||
"main": "dist/cli/cli.js",
|
||||
"bin": {
|
||||
|
|
1079
src/legacy/legacy.ts
1079
src/legacy/legacy.ts
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -53,7 +53,9 @@ export class CoverageService {
|
|||
map[name] = 0;
|
||||
}
|
||||
|
||||
map[name] = value;
|
||||
if (value > map[name]) {
|
||||
map[name] = value;
|
||||
}
|
||||
this.legacySaveCoverage(category);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче