Skip to content

Commit

Permalink
test(definitions): channel new tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Jul 24, 2024
1 parent 39b1754 commit 7c909a7
Show file tree
Hide file tree
Showing 50 changed files with 418 additions and 11,024 deletions.
59 changes: 59 additions & 0 deletions test/definitions/3.0.0/models/channel/channel parameter.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const jsonSchema = require('@definitions/3.0.0/parameter.json');

const config = new JsonSchemaTestSuiteConfig(
false,
[],
true,
[]
);

const data = new JsonSchemaTestSuiteData(
jsonSchema,
[
{
"description": "Id of the user.",
"default": "0e822ca6-5311-4d4c-b409-993a1820e689",
"enum": [
"0e822ca6-5311-4d4c-b409-993a1820e689",
"381f5ddc-75c6-4c21-9ec1-3919ed345be9",
"70559d88-31a5-4ef2-8c34-7fbd04057ed5",
"c6dc0047-a90d-4efa-95e3-a272282934e0"
],
"examples": [
"0e822ca6-5311-4d4c-b409-993a1820e689",
"381f5ddc-75c6-4c21-9ec1-3919ed345be9",
"70559d88-31a5-4ef2-8c34-7fbd04057ed5",
"c6dc0047-a90d-4efa-95e3-a272282934e0"
],
"location": "$message.payload#/user/id"
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
);

describe('Channel Parameter', () => {
new JsonSchemaTestSuite(data, config).testSuite()
});
82 changes: 82 additions & 0 deletions test/definitions/3.0.0/models/channel/channel.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const jsonSchema = require('@definitions/3.0.0/channel.json');

const config = new JsonSchemaTestSuiteConfig(
false,
[],
true,
[]
);

const data = new JsonSchemaTestSuiteData(
jsonSchema,
[
{
"address": "users.{userId}",
"title": "Users channel",
"description": "This channel is used to exchange messages about user events.",
"messages": {
"userSignedUp": {
"$ref": "#/components/messages/userSignedUp"
},
"userCompletedOrder": {
"$ref": "#/components/messages/userCompletedOrder"
}
},
"parameters": {
"userId": {
"$ref": "#/components/parameters/userId"
}
},
"servers": [
{ "$ref": "#/servers/rabbitmqInProd" },
{ "$ref": "#/servers/rabbitmqInStaging" }
],
"bindings": {
"amqp": {
"is": "queue",
"queue": {
"exclusive": true
}
}
},
"tags": [
{
"name": "user",
"description": "User-related messages"
}
],
"externalDocs": {
"description": "Find more info here",
"url": "https://example.com"
}
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
);

describe('Channel', () => {
new JsonSchemaTestSuite(data, config).testSuite()
});
1 change: 0 additions & 1 deletion test/definitions/3.0.0/models/channel/channel/empty.json

This file was deleted.

Loading

0 comments on commit 7c909a7

Please sign in to comment.