forked from asyncapi/spec-json-schemas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(definitions): operation new tests structure
- Loading branch information
Showing
34 changed files
with
281 additions
and
2,822 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
test/definitions/3.0.0/models/operation/operation reply address.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { | ||
JsonSchemaTestSuite, | ||
JsonSchemaTestSuiteConfig, | ||
JsonSchemaTestSuiteData | ||
} from '@test/definitions/base-schema-test.mjs'; | ||
import {describe} from 'vitest'; | ||
|
||
const jsonSchema = require('@definitions/3.0.0/operationReplyAddress.json'); | ||
|
||
const config = new JsonSchemaTestSuiteConfig( | ||
true, | ||
['must have required property \'location\''], | ||
true, | ||
[] | ||
); | ||
|
||
const data = new JsonSchemaTestSuiteData( | ||
jsonSchema, | ||
[ | ||
{ | ||
"description" : "Consumer inbox", | ||
"location" : "$message.header#/replyTo" | ||
} | ||
], | ||
{ | ||
"location" : "$message.header#/replyTo" | ||
}, | ||
{ | ||
"description" : "Consumer inbox" | ||
}, | ||
{ | ||
"location" : "$message.header#/replyTo", | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
} | ||
}, | ||
{ | ||
"location" : "$message.header#/replyTo", | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
}, | ||
"ext-number": 1 | ||
} | ||
); | ||
|
||
describe('Operation Reply Address', () => { | ||
new JsonSchemaTestSuite(data, config).testSuite() | ||
}); |
62 changes: 62 additions & 0 deletions
62
test/definitions/3.0.0/models/operation/operation reply.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
JsonSchemaTestSuite, | ||
JsonSchemaTestSuiteConfig, | ||
JsonSchemaTestSuiteData | ||
} from '@test/definitions/base-schema-test.mjs'; | ||
import {describe} from 'vitest'; | ||
|
||
const jsonSchema = require('@definitions/3.0.0/operationReply.json'); | ||
|
||
const config = new JsonSchemaTestSuiteConfig( | ||
false, | ||
[], | ||
true, | ||
[] | ||
); | ||
|
||
const data = new JsonSchemaTestSuiteData( | ||
jsonSchema, | ||
[ | ||
{ | ||
"address": { | ||
"description": "Consumer inbox", | ||
"location": "$message.header#/replyTo" | ||
}, | ||
"channel": { | ||
"$ref": "#/components/channels/channel" | ||
}, | ||
"messages": [ | ||
{ | ||
"$ref": "#/components/messages/message 1" | ||
}, | ||
{ | ||
"$ref": "#/components/messages/message 2" | ||
}, | ||
{ | ||
"$ref": "#/components/messages/message 3" | ||
} | ||
] | ||
} | ||
], | ||
{}, | ||
{}, | ||
{ | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
} | ||
}, | ||
{ | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
}, | ||
"ext-number": 1 | ||
} | ||
); | ||
|
||
describe('Operation Reply', () => { | ||
new JsonSchemaTestSuite(data, config).testSuite() | ||
}); |
83 changes: 83 additions & 0 deletions
83
test/definitions/3.0.0/models/operation/operation trait.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
JsonSchemaTestSuite, | ||
JsonSchemaTestSuiteConfig, | ||
JsonSchemaTestSuiteData | ||
} from '@test/definitions/base-schema-test.mjs'; | ||
import {describe} from 'vitest'; | ||
|
||
const jsonSchema = require('@definitions/3.0.0/operationTrait.json'); | ||
|
||
const config = new JsonSchemaTestSuiteConfig( | ||
false, | ||
[], | ||
true, | ||
[] | ||
); | ||
|
||
const data = new JsonSchemaTestSuiteData( | ||
jsonSchema, | ||
[ | ||
{ | ||
"title": "Send message operation", | ||
"summary": "Send message", | ||
"description": "Send message to remote server", | ||
"security": [ | ||
{ | ||
"type": "apiKey", | ||
"description": "apiKey", | ||
"in": "user" | ||
}, | ||
{ | ||
"$ref": "#/components/security/plain" | ||
} | ||
], | ||
"tags": [ | ||
{ | ||
"$ref": "#/components/tags/tag" | ||
} | ||
], | ||
"externalDocs": { | ||
"$ref": "#/components/externalDocs" | ||
}, | ||
"bindings": { | ||
"amqp":{ | ||
"expiration": 100000, | ||
"userId": "guest", | ||
"cc": [ | ||
"user.logs" | ||
], | ||
"priority": 10, | ||
"deliveryMode": 2, | ||
"mandatory": false, | ||
"bcc": [ | ||
"external.audit" | ||
], | ||
"timestamp": true, | ||
"ack": false, | ||
"bindingVersion": "0.3.0" | ||
} | ||
} | ||
} | ||
], | ||
{}, | ||
{}, | ||
{ | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
} | ||
}, | ||
{ | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
}, | ||
"ext-number": 1 | ||
} | ||
); | ||
|
||
describe('Operation Trait', () => { | ||
new JsonSchemaTestSuite(data, config).testSuite() | ||
}); |
84 changes: 84 additions & 0 deletions
84
test/definitions/3.0.0/models/operation/operation.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { | ||
JsonSchemaTestSuite, | ||
JsonSchemaTestSuiteConfig, | ||
JsonSchemaTestSuiteData | ||
} from '@test/definitions/base-schema-test.mjs'; | ||
import {describe} from 'vitest'; | ||
|
||
const jsonSchema = require('@definitions/3.0.0/operation.json'); | ||
|
||
const config = new JsonSchemaTestSuiteConfig( | ||
true, | ||
[ | ||
'must have required property \'action\'', | ||
'must have required property \'channel\'' | ||
], | ||
true, | ||
[] | ||
); | ||
|
||
const data = new JsonSchemaTestSuiteData( | ||
jsonSchema, | ||
[ | ||
{ | ||
"title": "User sign up", | ||
"summary": "Action to sign a user up.", | ||
"description": "A longer description", | ||
"channel": { | ||
"$ref": "#/channels/userSignup" | ||
}, | ||
"action": "send", | ||
"tags": [{ "name": "user" }, { "name": "signup" }, { "name": "register" }], | ||
"bindings": { | ||
"amqp": { | ||
"ack": false | ||
} | ||
}, | ||
"traits": [{ "$ref": "#/components/operationTraits/kafka" }] | ||
} | ||
], | ||
{ | ||
"channel": { | ||
"$ref": "#/channels/userSignup" | ||
}, | ||
"action": "send" | ||
}, | ||
{ | ||
"title": "User sign up", | ||
"summary": "Action to sign a user up.", | ||
"description": "A longer description", | ||
"bindings": { | ||
"amqp": { | ||
"ack": false | ||
} | ||
}, | ||
"traits": [{ "$ref": "#/components/operationTraits/kafka" }] | ||
}, | ||
{ | ||
"channel": { | ||
"$ref": "#/channels/userSignup" | ||
}, | ||
"action": "send", | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
} | ||
}, | ||
{ | ||
"channel": { | ||
"$ref": "#/channels/userSignup" | ||
}, | ||
"action": "send", | ||
"x-number": 0, | ||
"x-string": "", | ||
"x-object": { | ||
"property": {} | ||
}, | ||
"ext-number": 1 | ||
} | ||
); | ||
|
||
describe('Operation', () => { | ||
new JsonSchemaTestSuite(data, config).testSuite() | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.