Skip to content

Commit

Permalink
test(definitions): Amazon SQS bindings new tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Jul 26, 2024
1 parent cf979d5 commit 077e01a
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 220 deletions.
42 changes: 0 additions & 42 deletions test/bindings/sqs/0.2.0/channel/example.json

This file was deleted.

12 changes: 0 additions & 12 deletions test/bindings/sqs/0.2.0/channel/extended.json

This file was deleted.

6 changes: 0 additions & 6 deletions test/bindings/sqs/0.2.0/channel/only required properties.json

This file was deleted.

10 changes: 0 additions & 10 deletions test/bindings/sqs/0.2.0/channel/without required properties.json

This file was deleted.

12 changes: 0 additions & 12 deletions test/bindings/sqs/0.2.0/channel/wrongly extended.json

This file was deleted.

33 changes: 0 additions & 33 deletions test/bindings/sqs/0.2.0/operation/example.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/bindings/sqs/0.2.0/operation/extended.json

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions test/bindings/sqs/0.2.0/operation/wrongly extended.json

This file was deleted.

101 changes: 101 additions & 0 deletions test/bindings/sqs/sqs channel binding.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const config = new JsonSchemaTestSuiteConfig(
true,
[
'must have required property \'queue\'',
],
true,
[]
);

let data = {
"0.2.0": new JsonSchemaTestSuiteData(
require(`@bindings/sqs/0.2.0/channel.json`),
[
{
"queue": {
"name": "myQueue",
"fifoQueue": true,
"deduplicationScope": "messageGroup",
"fifoThroughputLimit": "perMessageGroupId",
"deliveryDelay": 15,
"visibilityTimeout": 60,
"receiveMessageWaitTime": 0,
"messageRetentionPeriod": 86400,
"redrivePolicy": {
"deadLetterQueue": {
"arn": "arn:aws:SQS:eu-west-1:0000000:123456789"
},
"maxReceiveCount": 15
},
"policy": {
"statements": [
{
"effect": "Deny",
"principal": "arn:aws:iam::123456789012:user/dec.kolakowski",
"action": [
"sqs:SendMessage",
"sqs:ReceiveMessage"
]
}
]
},
"tags": {
"owner": "AsyncAPI.NET",
"platform": "AsyncAPIOrg"
}
},
"deadLetterQueue": {
"name": "myQueue_error",
"fifoQueue": false,
"deliveryDelay": 0,
"visibilityTimeout": 0,
"receiveMessageWaitTime": 0,
"messageRetentionPeriod": 604800
}
}
],
{
"queue": {
"name": "myQueue",
"fifoQueue": true
}
},
{},
{
"queue": {
"name": "myQueue",
"fifoQueue": true
},
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"queue": {
"name": "myQueue",
"fifoQueue": true
},
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
),
}

describe.each([
'0.2.0',
])('Amazon SQS channel binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
98 changes: 98 additions & 0 deletions test/bindings/sqs/sqs operation binding.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const config = new JsonSchemaTestSuiteConfig(
true,
[
'must have required property \'queues\'',
],
true,
[]
);

let data = {
"0.2.0": new JsonSchemaTestSuiteData(
require(`@bindings/sqs/0.2.0/operation.json`),
[
{
"queues": [
{
"name": "myQueue",
"fifoQueue": true,
"deduplicationScope": "messageGroup",
"fifoThroughputLimit": "perMessageGroupId",
"deliveryDelay": 10,
"redrivePolicy": {
"deadLetterQueue": {
"name": "myQueue_error"
},
"maxReceiveCount": 15
},
"policy": {
"statements": [
{
"effect": "Deny",
"principal": "arn:aws:iam::123456789012:user/dec.kolakowski",
"action": [
"sqs:SendMessage",
"sqs:ReceiveMessage"
]
}
]
}
},
{
"name": "myQueue_error",
"deliveryDelay": 10
}
]
}
],
{
"queues": [
{
"name": "myQueue_error",
"deliveryDelay": 10
}
]
},
{},
{
"queues": [
{
"name": "myQueue_error",
"deliveryDelay": 10
}
],
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"queues": [
{
"name": "myQueue_error",
"deliveryDelay": 10
}
],
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
),
}

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

0 comments on commit 077e01a

Please sign in to comment.