integration: limit config schema tests to only include its own schema

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-08-19 10:34:22 +02:00
parent 0ade9d02b7
commit 244816f79c
4 changed files with 40 additions and 4 deletions
+10 -1
View File
@@ -30,9 +30,18 @@ describe('readAzureIntegrationConfig', () => {
async function buildFrontendConfig(
data: Partial<AzureIntegrationConfig>,
): Promise<Config> {
const schema = await loadConfigSchema({
const fullSchema = await loadConfigSchema({
dependencies: [require('../../package.json').name],
});
const serializedSchema = fullSchema.serialize() as {
schemas: { path: string }[];
};
const schema = await loadConfigSchema({
serialized: {
...serializedSchema, // grab the schema from this package only
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
},
});
const processed = schema.process(
[{ data: { integrations: { azure: [data] } }, context: 'app' }],
{ visibility: ['frontend'] },
@@ -30,9 +30,18 @@ describe('readBitbucketIntegrationConfig', () => {
async function buildFrontendConfig(
data: Partial<BitbucketIntegrationConfig>,
): Promise<Config> {
const schema = await loadConfigSchema({
const fullSchema = await loadConfigSchema({
dependencies: [require('../../package.json').name],
});
const serializedSchema = fullSchema.serialize() as {
schemas: { path: string }[];
};
const schema = await loadConfigSchema({
serialized: {
...serializedSchema, // grab the schema from this package only
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
},
});
const processed = schema.process(
[{ data: { integrations: { bitbucket: [data] } }, context: 'app' }],
{ visibility: ['frontend'] },
+10 -1
View File
@@ -30,9 +30,18 @@ describe('readGitHubIntegrationConfig', () => {
async function buildFrontendConfig(
data: Partial<GitHubIntegrationConfig>,
): Promise<Config> {
const schema = await loadConfigSchema({
const fullSchema = await loadConfigSchema({
dependencies: [require('../../package.json').name],
});
const serializedSchema = fullSchema.serialize() as {
schemas: { path: string }[];
};
const schema = await loadConfigSchema({
serialized: {
...serializedSchema, // grab the schema from this package only
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
},
});
const processed = schema.process(
[{ data: { integrations: { github: [data] } }, context: 'app' }],
{ visibility: ['frontend'] },
+10 -1
View File
@@ -30,9 +30,18 @@ describe('readGitLabIntegrationConfig', () => {
async function buildFrontendConfig(
data: Partial<GitLabIntegrationConfig>,
): Promise<Config> {
const schema = await loadConfigSchema({
const fullSchema = await loadConfigSchema({
dependencies: [require('../../package.json').name],
});
const serializedSchema = fullSchema.serialize() as {
schemas: { path: string }[];
};
const schema = await loadConfigSchema({
serialized: {
...serializedSchema, // grab the schema from this package only
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
},
});
const processed = schema.process(
[{ data: { integrations: { gitlab: [data] } }, context: 'app' }],
{ visibility: ['frontend'] },