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