Skip to content

Commit

Permalink
updating test files
Browse files Browse the repository at this point in the history
  • Loading branch information
RoshniNaveenaS committed Aug 23, 2024
1 parent c4bd78c commit ff49b7d
Show file tree
Hide file tree
Showing 7 changed files with 14,550 additions and 12,527 deletions.
156 changes: 119 additions & 37 deletions test/lib/compile/csdl2openapi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,28 +490,42 @@ describe('Edge cases', function () {
};
const openapi = lib.csdl2openapi(csdl, {});
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.typeDefinitionOld"],
{
title: "typeDefinitionOld",
openapi.components.schemas["jsonExamples.typeDefinitionOld"],
{
title: "typeDefinitionOld",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
"^[\\w\\.\\-\\/]+$": {
type: "string",
},
},
},
},
"JSON property old-style"
},
"JSON property old-style"
);
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.typeDefinitionNew"],
{
title: "typeDefinitionNew",
openapi.components.schemas["jsonExamples.typeDefinitionNew"],
{
title: "typeDefinitionNew",
type: "object",
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
}
"^[\\w\\.\\-\\/]+$": {
type: "string",
},
},
},
},
"JSON property new-style"
},
"JSON property new-style"
);
assert.deepStrictEqual(
openapi.components.schemas["jsonExamples.single"].properties.stream2,
Expand Down Expand Up @@ -567,10 +581,17 @@ describe('Edge cases', function () {
{
title: "typeDefinitionOld",
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
},
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string"
}
}
}
}
},
"JSON property old-style"
);
Expand All @@ -579,10 +600,17 @@ describe('Edge cases', function () {
{
title: "typeDefinitionNew",
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": { type: "string" },
}
properties: {
value: {
type: "object",
additionalProperties: false,
patternProperties: {
"^[\\w\\.\\-\\/]+$": {
type: "string"
}
}
}
}
},
"JSON property new-style"
);
Expand Down Expand Up @@ -2169,24 +2197,78 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot
assert.deepStrictEqual(
openapi.components.schemas["typeExamples.single"].properties,
{
withMaxLength: {
maxLength: 10,
allOf: [
{ $ref: "#/components/schemas/typeExamples.typeDefinitionNew" },
],
},
binary: { format: "base64url", type: "string" },
primitive: {
anyOf: [{ type: "boolean" }, { type: "number" }, { type: "string" }],
},
propertyPath: { type: "string" },
sbyte: { type: "integer", format: "int8" },
time: { type: "string", format: "time", example: "15:51:04" },
kaputt: {},
unknown: {
$ref: "#/components/schemas/typeExamples.un-known",
},
},
"withMaxLength": {
"allOf": [
{
"$ref": "#/components/schemas/typeExamples.typeDefinitionNew"
}
],
"maxLength": 10
},
"binary": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "base64url"
}
}
},
"primitive": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
}
]
}
}
},
"propertyPath": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"sbyte": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"format": "int8"
}
}
},
"time": {
"type": "object",
"properties": {
"value": {
"type": "string",
"format": "time",
"example": "15:51:04"
}
}
},
"kaputt": {
"type": "object",
"properties": {
"value": {}
}
},
"unknown": {
"$ref": "#/components/schemas/typeExamples.un-known"
}
},
"MaxLength"
);
});
Expand Down
Loading

0 comments on commit ff49b7d

Please sign in to comment.