Skip to content

Commit

Permalink
update description test wording
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolb committed Aug 26, 2024
1 parent 28959c9 commit a3cf9b8
Showing 1 changed file with 75 additions and 74 deletions.
149 changes: 75 additions & 74 deletions test/description-for-every-attribute.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,95 +32,96 @@ describe(ruleName, () => {
test('should throw an error if missing description', async () => {
const spec = await fsPromises.readFile(`${ resPath }/negative.json`);
const res = await spectral.run(spec.toString());

expect(res).toEqual([
const expectResult = [
{
code: ruleName,
message: 'For every attribute that is present in the OAS document, if a description is proposed as optional to complement that attribute, then yes it must be present; description is missing in the object',
path: [
'paths',
'/test',
'get',
'parameters',
'0',
"code": "description-for-every-attribute",
"message": "Every attribute in the OpenAPI document must have a description. Description fields that are marked as optional must be filled.; description is missing in the object",
"path": [
"paths",
"/test",
"get",
"parameters",
"0"
],
range: {
end: {
character: 29,
line: 36,
},
start: {
character: 11,
line: 29,
"severity": 0,
"range": {
"start": {
"line": 29,
"character": 11
},
},
severity: 0,
"end": {
"line": 36,
"character": 29
}
}
},
{
code: ruleName,
message: 'For every attribute that is present in the OAS document, if a description is proposed as optional to complement that attribute, then yes it must be present; description is missing in the object',
path: [
'paths',
'/test',
'get',
'responses',
'200',
"code": "description-for-every-attribute",
"message": "Every attribute in the OpenAPI document must have a description. Description fields that are marked as optional must be filled.; description is missing in the object",
"path": [
"paths",
"/test",
"get",
"responses",
"200"
],
range: {
end: {
character: 32,
line: 72,
"severity": 0,
"range": {
"start": {
"line": 41,
"character": 16
},
start: {
character: 16,
line: 41,
},
},
severity: 0,
"end": {
"line": 72,
"character": 32
}
}
},
{
code: ruleName,
message: 'For every attribute that is present in the OAS document, if a description is proposed as optional to complement that attribute, then yes it must be present; description is missing in the object',
path: [
'components',
'schemas',
'Pet',
"code": "description-for-every-attribute",
"message": "Every attribute in the OpenAPI document must have a description. Description fields that are marked as optional must be filled.; description is missing in the object",
"path": [
"components",
"schemas",
"Pet"
],
range: {
end: {
character: 28,
line: 160,
},
start: {
character: 12,
line: 143,
"severity": 0,
"range": {
"start": {
"line": 143,
"character": 12
},
},
severity: 0,
"end": {
"line": 160,
"character": 28
}
}
},
{
code: ruleName,
message: 'For every attribute that is present in the OAS document, if a description is proposed as optional to complement that attribute, then yes it must be present; description is missing in the object',
path: [
'components',
'schemas',
'Error',
'properties',
'message',
"code": "description-for-every-attribute",
"message": "Every attribute in the OpenAPI document must have a description. Description fields that are marked as optional must be filled.; description is missing in the object",
"path": [
"components",
"schemas",
"Error",
"properties",
"message"
],
range: {
end: {
character: 28,
line: 184,
"severity": 0,
"range": {
"start": {
"line": 183,
"character": 20
},
start: {
character: 20,
line: 183,
},
},
severity: 0,
},
]);
"end": {
"line": 184,
"character": 28
}
}
}
];

expect(res).toEqual(expectResult);
});
test('should pass with provided description', async () => {
const spec = await fsPromises.readFile(`${ resPath }/positive.json`);
Expand Down

0 comments on commit a3cf9b8

Please sign in to comment.