diff --git a/test/bindings/amqp/0.2.0/channel/empty.json b/test/bindings/amqp/0.2.0/channel/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.2.0/channel/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/examples/is queue.json b/test/bindings/amqp/0.2.0/channel/examples/is queue.json deleted file mode 100644 index 530d1ecb..00000000 --- a/test/bindings/amqp/0.2.0/channel/examples/is queue.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/examples/is routing key.json b/test/bindings/amqp/0.2.0/channel/examples/is routing key.json deleted file mode 100644 index f7f30ac7..00000000 --- a/test/bindings/amqp/0.2.0/channel/examples/is routing key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "is": "routingKey", - "exchange": { - "name": "myExchange", - "type": "topic", - "durable": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/extended.json b/test/bindings/amqp/0.2.0/channel/extended.json deleted file mode 100644 index 2f750d3e..00000000 --- a/test/bindings/amqp/0.2.0/channel/extended.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/only required properties.json b/test/bindings/amqp/0.2.0/channel/only required properties.json deleted file mode 100644 index beee99d3..00000000 --- a/test/bindings/amqp/0.2.0/channel/only required properties.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "is": "routingKey", - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/without required properties.json b/test/bindings/amqp/0.2.0/channel/without required properties.json deleted file mode 100644 index 2938f064..00000000 --- a/test/bindings/amqp/0.2.0/channel/without required properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "exchange": { - "name": "myExchange", - "type": "topic", - "durable": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/channel/wrongly extended.json b/test/bindings/amqp/0.2.0/channel/wrongly extended.json deleted file mode 100644 index df061e48..00000000 --- a/test/bindings/amqp/0.2.0/channel/wrongly extended.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/empty.json b/test/bindings/amqp/0.2.0/message/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.2.0/message/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/example.json b/test/bindings/amqp/0.2.0/message/example.json deleted file mode 100644 index 67fc27b2..00000000 --- a/test/bindings/amqp/0.2.0/message/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/extended.json b/test/bindings/amqp/0.2.0/message/extended.json deleted file mode 100644 index 9701a441..00000000 --- a/test/bindings/amqp/0.2.0/message/extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.2.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/only required properties.json b/test/bindings/amqp/0.2.0/message/only required properties.json deleted file mode 100644 index 281892d4..00000000 --- a/test/bindings/amqp/0.2.0/message/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/without required properties.json b/test/bindings/amqp/0.2.0/message/without required properties.json deleted file mode 100644 index 281892d4..00000000 --- a/test/bindings/amqp/0.2.0/message/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/message/wrongly extended.json b/test/bindings/amqp/0.2.0/message/wrongly extended.json deleted file mode 100644 index d00f98e2..00000000 --- a/test/bindings/amqp/0.2.0/message/wrongly extended.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.2.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/empty.json b/test/bindings/amqp/0.2.0/operation/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.2.0/operation/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/example.json b/test/bindings/amqp/0.2.0/operation/example.json deleted file mode 100644 index 535dd488..00000000 --- a/test/bindings/amqp/0.2.0/operation/example.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "expiration": 100000, - "userId": "guest", - "cc": [ - "user.logs" - ], - "priority": 10, - "deliveryMode": 2, - "mandatory": false, - "bcc": [ - "external.audit" - ], - "replyTo": "user.signedup", - "timestamp": true, - "ack": false, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/extended.json b/test/bindings/amqp/0.2.0/operation/extended.json deleted file mode 100644 index 2da8cc79..00000000 --- a/test/bindings/amqp/0.2.0/operation/extended.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/only required properties.json b/test/bindings/amqp/0.2.0/operation/only required properties.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.2.0/operation/only required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/without required properties.json b/test/bindings/amqp/0.2.0/operation/without required properties.json deleted file mode 100644 index 535dd488..00000000 --- a/test/bindings/amqp/0.2.0/operation/without required properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "expiration": 100000, - "userId": "guest", - "cc": [ - "user.logs" - ], - "priority": 10, - "deliveryMode": 2, - "mandatory": false, - "bcc": [ - "external.audit" - ], - "replyTo": "user.signedup", - "timestamp": true, - "ack": false, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.2.0/operation/wrongly extended.json b/test/bindings/amqp/0.2.0/operation/wrongly extended.json deleted file mode 100644 index e6738ad9..00000000 --- a/test/bindings/amqp/0.2.0/operation/wrongly extended.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/empty.json b/test/bindings/amqp/0.3.0/channel/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.3.0/channel/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/examples/is queue.json b/test/bindings/amqp/0.3.0/channel/examples/is queue.json deleted file mode 100644 index 7e893eed..00000000 --- a/test/bindings/amqp/0.3.0/channel/examples/is queue.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/examples/is routing key.json b/test/bindings/amqp/0.3.0/channel/examples/is routing key.json deleted file mode 100644 index c7b27515..00000000 --- a/test/bindings/amqp/0.3.0/channel/examples/is routing key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "is": "routingKey", - "exchange": { - "name": "myExchange", - "type": "topic", - "durable": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/extended.json b/test/bindings/amqp/0.3.0/channel/extended.json deleted file mode 100644 index cd51d044..00000000 --- a/test/bindings/amqp/0.3.0/channel/extended.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.3.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/only required properties.json b/test/bindings/amqp/0.3.0/channel/only required properties.json deleted file mode 100644 index beee99d3..00000000 --- a/test/bindings/amqp/0.3.0/channel/only required properties.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "is": "routingKey", - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/without required properties.json b/test/bindings/amqp/0.3.0/channel/without required properties.json deleted file mode 100644 index 2938f064..00000000 --- a/test/bindings/amqp/0.3.0/channel/without required properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "exchange": { - "name": "myExchange", - "type": "topic", - "durable": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.2.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/channel/wrongly extended.json b/test/bindings/amqp/0.3.0/channel/wrongly extended.json deleted file mode 100644 index da65e5a8..00000000 --- a/test/bindings/amqp/0.3.0/channel/wrongly extended.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "is": "queue", - "queue": { - "name": "my-queue-name", - "durable": true, - "exclusive": true, - "autoDelete": false, - "vhost": "/" - }, - "bindingVersion": "0.3.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/empty.json b/test/bindings/amqp/0.3.0/message/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.3.0/message/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/example.json b/test/bindings/amqp/0.3.0/message/example.json deleted file mode 100644 index fa5d13ff..00000000 --- a/test/bindings/amqp/0.3.0/message/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/extended.json b/test/bindings/amqp/0.3.0/message/extended.json deleted file mode 100644 index 9aa622c6..00000000 --- a/test/bindings/amqp/0.3.0/message/extended.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.3.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/only required properties.json b/test/bindings/amqp/0.3.0/message/only required properties.json deleted file mode 100644 index e50c8c3e..00000000 --- a/test/bindings/amqp/0.3.0/message/only required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/without required properties.json b/test/bindings/amqp/0.3.0/message/without required properties.json deleted file mode 100644 index e50c8c3e..00000000 --- a/test/bindings/amqp/0.3.0/message/without required properties.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/message/wrongly extended.json b/test/bindings/amqp/0.3.0/message/wrongly extended.json deleted file mode 100644 index f3ea9cc5..00000000 --- a/test/bindings/amqp/0.3.0/message/wrongly extended.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "contentEncoding": "gzip", - "messageType": "user.signup", - "bindingVersion": "0.3.0", - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/empty.json b/test/bindings/amqp/0.3.0/operation/empty.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.3.0/operation/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/example.json b/test/bindings/amqp/0.3.0/operation/example.json deleted file mode 100644 index 86b28401..00000000 --- a/test/bindings/amqp/0.3.0/operation/example.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "expiration": 100000, - "userId": "guest", - "cc": [ - "user.logs" - ], - "priority": 10, - "deliveryMode": 2, - "mandatory": false, - "bcc": [ - "external.audit" - ], - "timestamp": true, - "ack": false, - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/extended.json b/test/bindings/amqp/0.3.0/operation/extended.json deleted file mode 100644 index 2da8cc79..00000000 --- a/test/bindings/amqp/0.3.0/operation/extended.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/only required properties.json b/test/bindings/amqp/0.3.0/operation/only required properties.json deleted file mode 100644 index 9e26dfee..00000000 --- a/test/bindings/amqp/0.3.0/operation/only required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/without required properties.json b/test/bindings/amqp/0.3.0/operation/without required properties.json deleted file mode 100644 index 86b28401..00000000 --- a/test/bindings/amqp/0.3.0/operation/without required properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "expiration": 100000, - "userId": "guest", - "cc": [ - "user.logs" - ], - "priority": 10, - "deliveryMode": 2, - "mandatory": false, - "bcc": [ - "external.audit" - ], - "timestamp": true, - "ack": false, - "bindingVersion": "0.3.0" -} \ No newline at end of file diff --git a/test/bindings/amqp/0.3.0/operation/wrongly extended.json b/test/bindings/amqp/0.3.0/operation/wrongly extended.json deleted file mode 100644 index e6738ad9..00000000 --- a/test/bindings/amqp/0.3.0/operation/wrongly extended.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} \ No newline at end of file diff --git a/test/bindings/amqp/amqp channel binding.test.mjs b/test/bindings/amqp/amqp channel binding.test.mjs new file mode 100644 index 00000000..74173ef9 --- /dev/null +++ b/test/bindings/amqp/amqp channel binding.test.mjs @@ -0,0 +1,171 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'exchange\'', + 'must have required property \'queue\'', + 'must match exactly one schema in oneOf' + ], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.0/channel.json`), + [ + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + }, + { + "is": "routingKey", + "exchange": { + "name": "myExchange", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + } + ], + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + }, + { + "bindingVersion": "0.2.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 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.0/channel.json`), + [ + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + }, + { + "is": "routingKey", + "exchange": { + "name": "myExchange", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + } + ], + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + }, + { + "bindingVersion": "0.3.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' +])('AMQP channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/amqp/amqp message binding.test.mjs b/test/bindings/amqp/amqp message binding.test.mjs new file mode 100644 index 00000000..ffbcc3a5 --- /dev/null +++ b/test/bindings/amqp/amqp message binding.test.mjs @@ -0,0 +1,77 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.0/message.json`), + [ + { + "contentEncoding": "gzip", + "messageType": "user.signup", + "bindingVersion": "0.2.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.0/message.json`), + [ + { + "contentEncoding": "gzip", + "messageType": "user.signup", + "bindingVersion": "0.3.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' +])('AMQP message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/amqp/amqp operation binding.test.mjs b/test/bindings/amqp/amqp operation binding.test.mjs new file mode 100644 index 00000000..b5882714 --- /dev/null +++ b/test/bindings/amqp/amqp operation binding.test.mjs @@ -0,0 +1,99 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.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.2.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.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.3.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' +])('AMQP operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/amqp/amqp.test.mjs b/test/bindings/amqp/amqp.test.mjs deleted file mode 100644 index f9025e76..00000000 --- a/test/bindings/amqp/amqp.test.mjs +++ /dev/null @@ -1,125 +0,0 @@ -import {it, test} from 'vitest'; -import TestHelper from '@test/test-helper.mjs'; -import path from 'path'; - -describe.each([ - '0.2.0', - '0.3.0' -])('AMQP bindings v%s', async (bindingVersion) => { - - const channelSchema = await import(`@bindings/amqp/${bindingVersion}/channel.json`); - const messageSchema = await import(`@bindings/amqp/${bindingVersion}/message.json`); - const operationSchema = await import(`@bindings/amqp/${bindingVersion}/operation.json`); - - describe('channel', () => { - it('is: routingKey', () => TestHelper.objectIsValid( - channelSchema, - path.resolve(__dirname, `./${bindingVersion}/channel/examples/is routing key.json`), - )); - - it('is: queue', () => TestHelper.objectIsValid( - channelSchema, - path.resolve(__dirname, `./${bindingVersion}/channel/examples/is queue.json`), - )); - - it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( - channelSchema, - {}, - [ - 'must have required property \'exchange\'', - 'must have required property \'queue\'', - 'must match exactly one schema in oneOf' - ] - )); - - it.todo('without required properties - \'is\' must be required property?', () => TestHelper.objectIsNotValid( - channelSchema, - { - bindingVersion: bindingVersion - }, - [] - )); - - it.todo('only required properties - \'is\' must be required property?', () => TestHelper.objectIsNotValid( - channelSchema, - { - bindingVersion: bindingVersion - }, - [] - )); - - it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( - channelSchema, - path.resolve(__dirname, `./${bindingVersion}/channel/extended.json`), - )); - - it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( - channelSchema, - path.resolve(__dirname, `./${bindingVersion}/channel/wrongly extended.json`), - )); - }) - - describe('message', () => { - it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( - messageSchema, - path.resolve(__dirname, `./${bindingVersion}/message/example.json`), - )); - - it(TestHelper.canBeEmptyTestName, () => TestHelper.objectIsValid( - messageSchema, - {} - )); - - it(TestHelper.isValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsValid( - messageSchema, - path.resolve(__dirname, `./${bindingVersion}/message/without required properties.json`), - )); - - it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( - messageSchema, - path.resolve(__dirname, `./${bindingVersion}/message/only required properties.json`), - )); - - it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( - messageSchema, - path.resolve(__dirname, `./${bindingVersion}/message/extended.json`), - )); - - it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( - messageSchema, - path.resolve(__dirname, `./${bindingVersion}/message/wrongly extended.json`), - )); - }) - - describe('operation', () => { - it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( - operationSchema, - path.resolve(__dirname, `./${bindingVersion}/operation/example.json`), - )); - - it(TestHelper.canBeEmptyTestName, () => TestHelper.objectIsValid( - operationSchema, - {} - )); - - it(TestHelper.isValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsValid( - operationSchema, - path.resolve(__dirname, `./${bindingVersion}/operation/without required properties.json`), - )); - - it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( - operationSchema, - path.resolve(__dirname, `./${bindingVersion}/operation/only required properties.json`), - )); - - it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( - operationSchema, - path.resolve(__dirname, `./${bindingVersion}/operation/extended.json`), - )); - - it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( - operationSchema, - path.resolve(__dirname, `./${bindingVersion}/operation/wrongly extended.json`), - )); - }) -}) \ No newline at end of file diff --git a/test/definitions/base-schema-test.mjs b/test/definitions/base-schema-test.mjs index 31c88720..3c14bfb2 100644 --- a/test/definitions/base-schema-test.mjs +++ b/test/definitions/base-schema-test.mjs @@ -55,10 +55,12 @@ export class JsonSchemaTestSuite { testSuite() { - it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( - this.data.jsonSchema, - this.data.examples[0], - )); + for (const example of this.data.examples) { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + example, + )); + } if (this.config.hasRequiredProperties) { diff --git a/test/definitions/extended.json b/test/definitions/extended.json deleted file mode 100644 index 39302144..00000000 --- a/test/definitions/extended.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/wrongly extended.json b/test/definitions/wrongly extended.json deleted file mode 100644 index b5744bca..00000000 --- a/test/definitions/wrongly extended.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -}