Skip to content

Commit

Permalink
test(entities-plugins): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sumimakito committed Apr 3, 2024
1 parent ca8c76f commit e698011
Show file tree
Hide file tree
Showing 5 changed files with 817 additions and 310 deletions.
258 changes: 0 additions & 258 deletions packages/entities/entities-plugins/fixtures/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,264 +529,6 @@ export const konnectAvailablePlugins = {
* Form page data
*/

// CORS plugin
export const schema = {
fields: [
{
consumer: {
description: 'Custom type for representing a foreign key with a null value allowed.',
eq: null,
reference: 'consumers',
type: 'foreign',
},
},
{
consumer_group: {
description: 'Custom type for representing a foreign key with a null value allowed.',
eq: null,
reference: 'consumer_groups',
type: 'foreign',
},
},
{
protocols: {
default: [
'grpc',
'grpcs',
'http',
'https',
],
description: 'A set of strings representing HTTP protocols.',
elements: {
one_of: [
'grpc',
'grpcs',
'http',
'https',
],
type: 'string',
},
required: true,
type: 'set',
},
},
{
config: {
fields: [
{
origins: {
description: 'List of allowed domains for the `Access-Control-Allow-Origin` header. If you want to allow all origins, add `*` as a single value to this configuration field. The accepted values can either be flat strings or PCRE regexes.',
elements: {
type: 'string',
},
type: 'array',
},
},
{
headers: {
description: 'Value for the `Access-Control-Allow-Headers` header.',
elements: {
type: 'string',
},
type: 'array',
},
},
{
exposed_headers: {
description: 'Value for the `Access-Control-Expose-Headers` header. If not specified, no custom headers are exposed.',
elements: {
type: 'string',
},
type: 'array',
},
},
{
methods: {
default: [
'GET',
'HEAD',
'PUT',
'PATCH',
'POST',
'DELETE',
'OPTIONS',
'TRACE',
'CONNECT',
],
description: "'Value for the `Access-Control-Allow-Methods` header. Available options include `GET`, `HEAD`, `PUT`, `PATCH`, `POST`, `DELETE`, `OPTIONS`, `TRACE`, `CONNECT`. By default, all options are allowed.'",
elements: {
one_of: [
'GET',
'HEAD',
'PUT',
'PATCH',
'POST',
'DELETE',
'OPTIONS',
'TRACE',
'CONNECT',
],
type: 'string',
},
type: 'array',
},
},
{
max_age: {
description: 'Indicates how long the results of the preflight request can be cached, in `seconds`.',
type: 'number',
},
},
{
credentials: {
default: false,
description: 'Flag to determine whether the `Access-Control-Allow-Credentials` header should be sent with `true` as the value.',
required: true,
type: 'boolean',
},
},
{
preflight_continue: {
default: false,
description: 'A boolean value that instructs the plugin to proxy the `OPTIONS` preflight request to the Upstream service.',
required: true,
type: 'boolean',
},
},
{
private_network: {
default: false,
description: 'Flag to determine whether the `Access-Control-Allow-Private-Network` header should be sent with `true` as the value.',
required: true,
type: 'boolean',
},
},
],
required: true,
type: 'record',
},
},
],
}

// Mocking plugin
export const schema2 = {
fields: [
{
protocols: {
default: [
'grpc',
'grpcs',
'http',
'https',
],
description: 'A set of strings representing HTTP protocols.',
elements: {
one_of: [
'grpc',
'grpcs',
'http',
'https',
],
type: 'string',
},
required: true,
type: 'set',
},
},
{
consumer_group: {
description: 'Custom type for representing a foreign key with a null value allowed.',
eq: null,
reference: 'consumer_groups',
type: 'foreign',
},
},
{
config: {
fields: [
{
api_specification_filename: {
description: "The path and name of the specification file loaded into Kong Gateway's database. You cannot use this option for DB-less or hybrid mode.",
required: false,
type: 'string',
},
},
{
api_specification: {
description: 'The contents of the specification file. You must use this option for hybrid or DB-less mode. You can include the full specification as part of the configuration. In Kong Manager, you can copy and paste the contents of the spec directly into the `Config.Api Specification` text field.',
required: false,
type: 'string',
},
},
{
random_delay: {
default: false,
description: 'Enables a random delay in the mocked response. Introduces delays to simulate real-time response times by APIs.',
type: 'boolean',
},
},
{
max_delay_time: {
default: 1,
description: 'The maximum value in seconds of delay time. Set this value when `random_delay` is enabled and you want to adjust the default. The value must be greater than the `min_delay_time`.',
type: 'number',
},
},
{
min_delay_time: {
default: 0.001,
description: 'The minimum value in seconds of delay time. Set this value when `random_delay` is enabled and you want to adjust the default. The value must be less than the `max_delay_time`.',
type: 'number',
},
},
{
random_examples: {
default: false,
description: 'Randomly selects one example and returns it. This parameter requires the spec to have multiple examples configured.',
type: 'boolean',
},
},
{
included_status_codes: {
description: 'A global list of the HTTP status codes that can only be selected and returned.',
elements: {
type: 'integer',
},
type: 'array',
},
},
{
random_status_code: {
default: false,
description: 'Determines whether to randomly select an HTTP status code from the responses of the corresponding API method. The default value is `false`, which means the minimum HTTP status code is always selected and returned.',
required: true,
type: 'boolean',
},
},
{
include_base_path: {
default: false,
description: 'Indicates whether to include the base path when performing path match evaluation.',
required: true,
type: 'boolean',
},
},
{
required_non_checkbox_field: {
description: 'A non-checkbox but required field.',
required: true,
type: 'string',
},
},
],
required: true,
type: 'record',
},
},
],
}

// ACL plugin credential
export const credentialSchema = {
fields: [
Expand Down
Loading

0 comments on commit e698011

Please sign in to comment.