Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: extended test cases #1

Merged
merged 4 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading