Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adilmirz committed Aug 4, 2023
1 parent 9d615b1 commit 6d851af
Show file tree
Hide file tree
Showing 86 changed files with 226 additions and 226 deletions.
10 changes: 5 additions & 5 deletions test/authenticate-requests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests; "get.security" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -58,7 +58,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests; "post.security" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -78,7 +78,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests; "put.security" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -98,7 +98,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests; "delete.security" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -118,7 +118,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'API.REST.SECURITY.03: My API authenticates and authorizes all requests; "options.security" property must be truthy',
path: [
'paths',
'/test',
Expand Down
6 changes: 3 additions & 3 deletions test/date-response-header-format-pattern-requirement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'All \'Date\' response headers should use a custom pattern match for RFC 5322. date-time or other given formats should not be used (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; "schema.pattern" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -61,7 +61,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'All \'Date\' response headers should use a custom pattern match for RFC 5322. date-time or other given formats should not be used (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; "format" property must be falsy',
path: [
'paths',
'/test',
Expand All @@ -87,7 +87,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'All \'Date\' response headers should use a custom pattern match for RFC 5322. date-time or other given formats should not be used (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; "schema.pattern" property must be truthy',
path: [
'paths',
'/anotherTest',
Expand Down
2 changes: 1 addition & 1 deletion test/date-response-header-regex-check.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'The regex pattern used does not pass basic linting sample checks - should not have matched case Thu 8 Apr 2021 19:06:27 GMT (Comma required after Day of Week) (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; The regex pattern used does not pass basic linting sample checks - should not have matched case Thu 8 Apr 2021 19:06:27 GMT (Comma required after Day of Week)',
path: [
'paths',
'/test',
Expand Down
8 changes: 4 additions & 4 deletions test/date-response-header-requirement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'All responses must include a \'Date\' header (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; An expected pathway is missing. Prerequisite: "headers", search: "Date"',
path: [
'paths',
'/test',
Expand All @@ -58,7 +58,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'All responses must include a \'Date\' header (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; An expected pathway is missing. Prerequisite: "headers", search: "Date"',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -87,7 +87,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'All responses must include a \'Date\' header (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; An expected pathway is missing. Prerequisite: "headers", search: "Date"',
path: [
'paths',
'/test',
Expand All @@ -109,7 +109,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'All responses must include a \'Date\' header (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'All responses include a \'Date\' header in the GMT timezone and RFC 5322 format.; An expected pathway is missing. Prerequisite: "headers", search: "Date"',
path: [
'paths',
'/test',
Expand Down
2 changes: 1 addition & 1 deletion test/delete-204-success.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'DELETE operation must return \'204 No Content\' on success (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'DELETE operations return \'204 No Content\' on success.; "responses[204]" property must be truthy',
path: [
'paths',
'/test',
Expand Down
8 changes: 4 additions & 4 deletions test/etag-header-match-required.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ describe(ruleName, () => {
const spec = await fsPromises.readFile(`${ resPath }/negative.yml`);
const res = await spectral.run(spec.toString());

expect(res).toEqual([
expect([res[1]]).toEqual([
{
code: ruleName,
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers.; "headers.If-None-Match" property must be truthy',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -66,7 +66,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers.; "headers.If-None-Match" property must be truthy',
path: [
'paths',
'/test',
Expand All @@ -89,7 +89,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'In cases where ETag is supported, such resources should also support If-Match and If-None-Match request headers.; "headers.If-Match" property must be truthy',
path: [
'paths',
'/anotherTest',
Expand Down
8 changes: 4 additions & 4 deletions test/head-operations-match-headers-with-get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'The following headers are missing from the HEAD operation for response code 200: X-RateLimit-Limit (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'HEAD operations must return response headers identical to the corresponding GET.; The following headers are missing from the HEAD operation for response code 200: X-RateLimit-Limit',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -67,7 +67,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'The HEAD operation for response code 200 is missing a "headers" definition (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'HEAD operations must return response headers identical to the corresponding GET.; The HEAD operation for response code 200 is missing a "headers" definition',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -116,7 +116,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'The following headers are missing from the HEAD operation for response code 200: X-RateLimit-Limit (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'HEAD operations must return response headers identical to the corresponding GET.; The following headers are missing from the HEAD operation for response code 200: X-RateLimit-Limit',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -146,7 +146,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'The HEAD operation for response code 200 is missing a "headers" definition (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'HEAD operations must return response headers identical to the corresponding GET.; The HEAD operation for response code 200 is missing a "headers" definition',
path: [
'paths',
'/test',
Expand Down
2 changes: 1 addition & 1 deletion test/no-crud-verbs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Standard CRUD lifecycle operations map to HTTP verbs; Functional resources are used when non-standard CRUD are needed (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Standard CRUD lifecycle operations map to HTTP verbs; Functional resources are used when non-standard CRUD are needed.; Standard CRUD lifecycle operations map to HTTP verbs; Functional resources are used when non-standard CRUD are needed',
path: [
'paths',
'/test/get',
Expand Down
2 changes: 1 addition & 1 deletion test/no-etag-cache-control-header-required.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Where caching is not appropriate, operations must include a Cache-Control header (e.g. max-age=0, no-cache, no-store, must-revalidate) and must not include an ETag header (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Where caching is not appropriate, operations must include a Cache-Control header (e.g. max-age=0, no-cache, no-store, must-revalidate) and must not include an ETag header.; "headers.Cache-Control" property must be truthy',
path: [
'paths',
'/test',
Expand Down
4 changes: 2 additions & 2 deletions test/oas2-application-json-charset-utf8-required.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('ruleName', () => {
expect(res).toEqual([
{
code: ruleName,
message: 'JSON representations should be declared using \'application/json\' or \'application/json; charset=UTF-8\' media types (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'JSON representations should be declared using \'application/json\' or \'application/json; charset=UTF-8\' media types.; "application/json; charset=utf-16" must not match the pattern "^application/json; charset=(?![Uu][Tt][Ff]-8$)"',
path: [
'paths',
'/test',
Expand All @@ -59,7 +59,7 @@ describe('ruleName', () => {
},
{
code: ruleName,
message: 'JSON representations should be declared using \'application/json\' or \'application/json; charset=UTF-8\' media types (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'JSON representations should be declared using \'application/json\' or \'application/json; charset=UTF-8\' media types.; "application/json; charset=utf-16" must not match the pattern "^application/json; charset=(?![Uu][Tt][Ff]-8$)"',
path: [
'paths',
'/test',
Expand Down
6 changes: 3 additions & 3 deletions test/oas2-array-plural-representation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Representation fields use plural noun names for collections (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use plural noun names for collections.; device should be plural.',
path: [
'paths',
'/test',
Expand All @@ -62,7 +62,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Representation fields use plural noun names for collections (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use plural noun names for collections.; contract should be plural.',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -90,7 +90,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Representation fields use plural noun names for collections (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use plural noun names for collections.; balance should be plural.',
path: [
'paths',
'/test',
Expand Down
6 changes: 3 additions & 3 deletions test/oas2-collections-returned-as-arrays.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Collections should be encapsulated within an object. Do not return un-encapsulated arrays (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Collections are returned as arrays encapsulated with a named field such as \'items\'.; "array" must not match the pattern "^array$"',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -68,7 +68,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Collections should be encapsulated within an object. Do not return un-encapsulated arrays (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Collections are returned as arrays encapsulated with a named field such as \'items\'.; "array" must not match the pattern "^array$"',
path: [
'paths',
'/test',
Expand All @@ -92,7 +92,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Collections should be encapsulated within an object. Do not return un-encapsulated arrays (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Collections are returned as arrays encapsulated with a named field such as \'items\'.; "array" must not match the pattern "^array$"',
path: [
'paths',
'/test',
Expand Down
8 changes: 4 additions & 4 deletions test/oas2-date-fields-iso-format.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time.; Field timestamp should be type "string" with a format of "date-time".',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -66,7 +66,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time.; Field requestDate should be type "string" with a format of "date-time".',
path: [
'paths',
'/test',
Expand All @@ -91,7 +91,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time.; Field date should be type "string" with a format of "date-time".',
path: [
'paths',
'/test',
Expand All @@ -116,7 +116,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Representation fields use strings in \'iso-date-time\' format (RFC-3339) for date/time.; Field dates\'s items should be type "string" with a format of "date-time".',
path: [
'paths',
'/test',
Expand Down
8 changes: 4 additions & 4 deletions test/oas2-error-message.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Error representations include a useful human-readable message. (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Error representations include a useful human-readable message.; Error representations include a useful human-readable message.',
path: [
'paths',
'/test',
Expand All @@ -59,7 +59,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Error representations include a useful human-readable message. (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Error representations include a useful human-readable message.; Error representations include a useful human-readable message.',
path: [
'paths',
'/test',
Expand Down Expand Up @@ -100,7 +100,7 @@ describe(ruleName, () => {
expect(res).toEqual([
{
code: ruleName,
message: 'Error representations include a useful human-readable message. (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Error representations include a useful human-readable message.; Error representations include a useful human-readable message.',
path: [
'paths',
'/test',
Expand All @@ -122,7 +122,7 @@ describe(ruleName, () => {
},
{
code: ruleName,
message: 'Error representations include a useful human-readable message. (https://developer.cisco.com/docs/api-insights/#!api-guidelines-analyzer)',
message: 'Error representations include a useful human-readable message.; Error representations include a useful human-readable message.',
path: [
'paths',
'/test',
Expand Down
Loading

0 comments on commit 6d851af

Please sign in to comment.