mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-18 13:48:58 +02:00
fix: enabling more tests with strict schema validation (#3081)
This commit is contained in:
parent
c78b2d8325
commit
c14621a09a
@ -16,6 +16,10 @@ export const featureEventsSchema = {
|
|||||||
type: 'array',
|
type: 'array',
|
||||||
items: { $ref: eventSchema.$id },
|
items: { $ref: eventSchema.$id },
|
||||||
},
|
},
|
||||||
|
totalEvents: {
|
||||||
|
type: 'integer',
|
||||||
|
minimum: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
|
@ -97,6 +97,13 @@ export const featureSchema = {
|
|||||||
},
|
},
|
||||||
description: 'The list of feature variants',
|
description: 'The list of feature variants',
|
||||||
},
|
},
|
||||||
|
strategies: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
},
|
||||||
|
description: 'This is a legacy field that will be deprecated',
|
||||||
|
},
|
||||||
tags: {
|
tags: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: {
|
items: {
|
||||||
|
@ -23,6 +23,7 @@ export const healthOverviewSchema = {
|
|||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
nullable: true,
|
||||||
},
|
},
|
||||||
members: {
|
members: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@ -50,6 +51,10 @@ export const healthOverviewSchema = {
|
|||||||
favorite: {
|
favorite: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
|
stats: {
|
||||||
|
$ref: '#/components/schemas/projectStatsSchema',
|
||||||
|
description: 'Project statistics',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import dbInit from '../../helpers/database-init';
|
import dbInit from '../../helpers/database-init';
|
||||||
import getLogger from '../../../fixtures/no-logger';
|
import getLogger from '../../../fixtures/no-logger';
|
||||||
import { setupApp } from '../../helpers/test-helper';
|
import { setupAppWithCustomConfig } from '../../helpers/test-helper';
|
||||||
|
|
||||||
let app;
|
let app;
|
||||||
let db;
|
let db;
|
||||||
@ -9,7 +9,13 @@ const PATH = '/api/admin/constraints/validate';
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('constraints', getLogger);
|
db = await dbInit('constraints', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import dbInit, { ITestDb } from '../../helpers/database-init';
|
import dbInit, { ITestDb } from '../../helpers/database-init';
|
||||||
import getLogger from '../../../fixtures/no-logger';
|
import getLogger from '../../../fixtures/no-logger';
|
||||||
import { IUnleashTest, setupApp } from '../../helpers/test-helper';
|
import {
|
||||||
|
IUnleashTest,
|
||||||
|
setupAppWithCustomConfig,
|
||||||
|
} from '../../helpers/test-helper';
|
||||||
import { DEFAULT_ENV } from '../../../../lib/util/constants';
|
import { DEFAULT_ENV } from '../../../../lib/util/constants';
|
||||||
|
|
||||||
let app: IUnleashTest;
|
let app: IUnleashTest;
|
||||||
@ -8,7 +11,13 @@ let db: ITestDb;
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('environment_api_serial', getLogger);
|
db = await dbInit('environment_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { IUnleashTest, setupApp } from '../../helpers/test-helper';
|
import {
|
||||||
|
IUnleashTest,
|
||||||
|
setupAppWithCustomConfig,
|
||||||
|
} from '../../helpers/test-helper';
|
||||||
import dbInit, { ITestDb } from '../../helpers/database-init';
|
import dbInit, { ITestDb } from '../../helpers/database-init';
|
||||||
import getLogger from '../../../fixtures/no-logger';
|
import getLogger from '../../../fixtures/no-logger';
|
||||||
import { FEATURE_CREATED, IBaseEvent } from '../../../../lib/types/events';
|
import { FEATURE_CREATED, IBaseEvent } from '../../../../lib/types/events';
|
||||||
@ -11,7 +14,13 @@ let eventStore: IEventStore;
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('event_api_serial', getLogger);
|
db = await dbInit('event_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
eventStore = db.stores.eventStore;
|
eventStore = db.stores.eventStore;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dbInit, { ITestDb } from '../../helpers/database-init';
|
import dbInit, { ITestDb } from '../../helpers/database-init';
|
||||||
import {
|
import {
|
||||||
IUnleashTest,
|
IUnleashTest,
|
||||||
setupApp,
|
|
||||||
setupAppWithCustomConfig,
|
setupAppWithCustomConfig,
|
||||||
} from '../../helpers/test-helper';
|
} from '../../helpers/test-helper';
|
||||||
import getLogger from '../../../fixtures/no-logger';
|
import getLogger from '../../../fixtures/no-logger';
|
||||||
@ -24,7 +23,13 @@ const defaultStrategy = {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('feature_api_serial', getLogger);
|
db = await dbInit('feature_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const createToggle = async (
|
const createToggle = async (
|
||||||
toggle: FeatureToggleDTO,
|
toggle: FeatureToggleDTO,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import dbInit from '../../../helpers/database-init';
|
import dbInit from '../../../helpers/database-init';
|
||||||
import { setupApp } from '../../../helpers/test-helper';
|
import { setupAppWithCustomConfig } from '../../../helpers/test-helper';
|
||||||
import getLogger from '../../../../fixtures/no-logger';
|
import getLogger from '../../../../fixtures/no-logger';
|
||||||
|
|
||||||
let app;
|
let app;
|
||||||
@ -8,7 +8,13 @@ let user;
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('project_health_api_serial', getLogger);
|
db = await dbInit('project_health_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
user = await db.stores.userStore.insert({
|
user = await db.stores.userStore.insert({
|
||||||
name: 'Some Name',
|
name: 'Some Name',
|
||||||
email: 'test@getunleash.io',
|
email: 'test@getunleash.io',
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { IUnleashTest, setupApp } from '../../../helpers/test-helper';
|
import {
|
||||||
|
IUnleashTest,
|
||||||
|
setupAppWithCustomConfig,
|
||||||
|
} from '../../../helpers/test-helper';
|
||||||
import dbInit, { ITestDb } from '../../../helpers/database-init';
|
import dbInit, { ITestDb } from '../../../helpers/database-init';
|
||||||
import getLogger from '../../../../fixtures/no-logger';
|
import getLogger from '../../../../fixtures/no-logger';
|
||||||
import * as jsonpatch from 'fast-json-patch';
|
import * as jsonpatch from 'fast-json-patch';
|
||||||
@ -9,7 +12,13 @@ let db: ITestDb;
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('project_feature_variants_api_serial', getLogger);
|
db = await dbInit('project_feature_variants_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
await db.stores.environmentStore.create({
|
await db.stores.environmentStore.create({
|
||||||
name: 'development',
|
name: 'development',
|
||||||
type: 'development',
|
type: 'development',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import dbInit from '../../helpers/database-init';
|
import dbInit from '../../helpers/database-init';
|
||||||
import { setupApp } from '../../helpers/test-helper';
|
import { setupAppWithCustomConfig } from '../../helpers/test-helper';
|
||||||
import getLogger from '../../../fixtures/no-logger';
|
import getLogger from '../../../fixtures/no-logger';
|
||||||
|
|
||||||
let app;
|
let app;
|
||||||
@ -7,7 +7,13 @@ let db;
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('tag_api_serial', getLogger);
|
db = await dbInit('tag_api_serial', getLogger);
|
||||||
app = await setupApp(db.stores);
|
app = await setupAppWithCustomConfig(db.stores, {
|
||||||
|
experimental: {
|
||||||
|
flags: {
|
||||||
|
strictSchemaValidation: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
@ -1223,6 +1223,10 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"toggleName": {
|
"toggleName": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
"totalEvents": {
|
||||||
|
"minimum": 0,
|
||||||
|
"type": "integer",
|
||||||
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
@ -1323,6 +1327,13 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"example": false,
|
"example": false,
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
},
|
},
|
||||||
|
"strategies": {
|
||||||
|
"description": "This is a legacy field that will be deprecated",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"description": "The list of feature tags",
|
"description": "The list of feature tags",
|
||||||
"items": {
|
"items": {
|
||||||
@ -1660,6 +1671,7 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"description": {
|
"description": {
|
||||||
|
"nullable": true,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"environments": {
|
"environments": {
|
||||||
@ -1686,6 +1698,10 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
"stats": {
|
||||||
|
"$ref": "#/components/schemas/projectStatsSchema",
|
||||||
|
"description": "Project statistics",
|
||||||
|
},
|
||||||
"updatedAt": {
|
"updatedAt": {
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
@ -1708,6 +1724,7 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
|
"nullable": true,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"environments": {
|
"environments": {
|
||||||
@ -1740,6 +1757,10 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"staleCount": {
|
"staleCount": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
|
"stats": {
|
||||||
|
"$ref": "#/components/schemas/projectStatsSchema",
|
||||||
|
"description": "Project statistics",
|
||||||
|
},
|
||||||
"updatedAt": {
|
"updatedAt": {
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user