Skip to content

Commit

Permalink
test: add amqp 0.4.0 binding test
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Bodiachevskii <[email protected]>
  • Loading branch information
timonback and Pakisan committed Oct 2, 2024
1 parent 5a4092e commit b0e19f8
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 6 deletions.
4 changes: 1 addition & 3 deletions bindings/amqp/0.4.0/channel.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
},
"channel": {
"type": "object",
"properties": {
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
}
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
"exchange": {
"type": "object",
Expand Down
3 changes: 3 additions & 0 deletions test/ajv-schemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ function bindingSchemes(ajv) {
ajv.addSchema(require('@bindings/amqp/0.3.0/channel.json'));
ajv.addSchema(require('@bindings/amqp/0.3.0/message.json'));
ajv.addSchema(require('@bindings/amqp/0.3.0/operation.json'));
ajv.addSchema(require('@bindings/amqp/0.4.0/channel.json'));
ajv.addSchema(require('@bindings/amqp/0.4.0/message.json'));
ajv.addSchema(require('@bindings/amqp/0.4.0/operation.json'));

ajv.addSchema(require('@bindings/anypointmq/0.0.1/channel.json'));
ajv.addSchema(require('@bindings/anypointmq/0.0.1/message.json'));
Expand Down
90 changes: 89 additions & 1 deletion test/bindings/amqp/amqp channel binding.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,100 @@ let data = {
},
"ext-number": 1
}
),
"0.4.0": new JsonSchemaTestSuiteData(
require(`@bindings/amqp/0.4.0/channel.json`),
[
{
"is": "queue",
"queue": {
"name": "my-queue-name",
"durable": true,
"exclusive": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.4.0"
},
{
"is": "routingKey",
"exchange": {
"name": "myExchange",
"type": "topic",
"durable": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.4.0"
},
{
"is": "routingKey",
"name": "routingKeyName",
"channel": {
"$ref": "#/components/channels/queue-update"
},
"exchange": {
"name": "myExchange",
"type": "topic",
"durable": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.4.0"
}
],
{
"is": "queue",
"queue": {
"name": "my-queue-name",
"durable": true,
"exclusive": true,
"autoDelete": false,
"vhost": "/"
},
"bindingVersion": "0.4.0"
},
{
"bindingVersion": "0.4.0"
},
{
"is": "queue",
"queue": {
"name": "my-queue-name",
"durable": true,
"exclusive": true,
"autoDelete": false,
"vhost": "/"
},
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"is": "queue",
"queue": {
"name": "my-queue-name",
"durable": true,
"exclusive": true,
"autoDelete": false,
"vhost": "/"
},
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
)
}

describe.each([
'0.2.0',
'0.3.0'
'0.3.0',
'0.4.0',
])('AMQP channel binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
30 changes: 29 additions & 1 deletion test/bindings/amqp/amqp message binding.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,40 @@ let data = {
},
"ext-number": 1
}
),
"0.4.0": new JsonSchemaTestSuiteData(
require(`@bindings/amqp/0.4.0/message.json`),
[
{
"contentEncoding": "gzip",
"messageType": "user.signup",
"bindingVersion": "0.4.0"
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
)
}

describe.each([
'0.2.0',
'0.3.0'
'0.3.0',
'0.4.0'
])('AMQP message binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
41 changes: 40 additions & 1 deletion test/bindings/amqp/amqp operation binding.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,51 @@ let data = {
},
"ext-number": 1
}
),
"0.4.0": new JsonSchemaTestSuiteData(
require(`@bindings/amqp/0.4.0/operation.json`),
[
{
"expiration": 100000,
"userId": "guest",
"cc": [
"user.logs"
],
"priority": 10,
"deliveryMode": 2,
"mandatory": false,
"bcc": [
"external.audit"
],
"timestamp": true,
"ack": false,
"bindingVersion": "0.4.0"
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
)
}

describe.each([
'0.2.0',
'0.3.0'
'0.3.0',
'0.4.0'
])('AMQP operation binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})

0 comments on commit b0e19f8

Please sign in to comment.