plugins,packages: replace usages of ConfigReader.from
This commit is contained in:
@@ -20,21 +20,16 @@ import { AzureIntegration } from './AzureIntegration';
|
||||
describe('AzureIntegration', () => {
|
||||
it('has a working factory', () => {
|
||||
const integrations = AzureIntegration.factory({
|
||||
config: ConfigReader.fromConfigs([
|
||||
{
|
||||
context: '',
|
||||
data: {
|
||||
integrations: {
|
||||
azure: [
|
||||
{
|
||||
host: 'h.com',
|
||||
token: 'token',
|
||||
},
|
||||
],
|
||||
config: new ConfigReader({
|
||||
integrations: {
|
||||
azure: [
|
||||
{
|
||||
host: 'h.com',
|
||||
token: 'token',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
}),
|
||||
});
|
||||
expect(integrations.length).toBe(2); // including default
|
||||
expect(integrations[0].predicate(new URL('https://h.com/a'))).toBe(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
describe('readAzureIntegrationConfig', () => {
|
||||
function buildConfig(data: Partial<AzureIntegrationConfig>): Config {
|
||||
return ConfigReader.fromConfigs([{ context: '', data }]);
|
||||
return new ConfigReader(data);
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
@@ -60,9 +60,7 @@ describe('readAzureIntegrationConfig', () => {
|
||||
|
||||
describe('readAzureIntegrationConfigs', () => {
|
||||
function buildConfig(data: Partial<AzureIntegrationConfig>[]): Config[] {
|
||||
return data.map(item =>
|
||||
ConfigReader.fromConfigs([{ context: '', data: item }]),
|
||||
);
|
||||
return data.map(item => new ConfigReader(item));
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
|
||||
@@ -20,24 +20,19 @@ import { BitbucketIntegration } from './BitbucketIntegration';
|
||||
describe('BitbucketIntegration', () => {
|
||||
it('has a working factory', () => {
|
||||
const integrations = BitbucketIntegration.factory({
|
||||
config: ConfigReader.fromConfigs([
|
||||
{
|
||||
context: '',
|
||||
data: {
|
||||
integrations: {
|
||||
bitbucket: [
|
||||
{
|
||||
host: 'h.com',
|
||||
apiBaseUrl: 'a',
|
||||
token: 't',
|
||||
username: 'u',
|
||||
appPassword: 'p',
|
||||
},
|
||||
],
|
||||
config: new ConfigReader({
|
||||
integrations: {
|
||||
bitbucket: [
|
||||
{
|
||||
host: 'h.com',
|
||||
apiBaseUrl: 'a',
|
||||
token: 't',
|
||||
username: 'u',
|
||||
appPassword: 'p',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
}),
|
||||
});
|
||||
expect(integrations.length).toBe(2); // including default
|
||||
expect(integrations[0].predicate(new URL('https://h.com/a'))).toBe(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
describe('readBitbucketIntegrationConfig', () => {
|
||||
function buildConfig(data: Partial<BitbucketIntegrationConfig>): Config {
|
||||
return ConfigReader.fromConfigs([{ context: '', data }]);
|
||||
return new ConfigReader(data);
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
@@ -83,9 +83,7 @@ describe('readBitbucketIntegrationConfig', () => {
|
||||
|
||||
describe('readBitbucketIntegrationConfigs', () => {
|
||||
function buildConfig(data: Partial<BitbucketIntegrationConfig>[]): Config[] {
|
||||
return data.map(item =>
|
||||
ConfigReader.fromConfigs([{ context: '', data: item }]),
|
||||
);
|
||||
return data.map(item => new ConfigReader(item));
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
|
||||
@@ -20,23 +20,18 @@ import { GitHubIntegration } from './GitHubIntegration';
|
||||
describe('GitHubIntegration', () => {
|
||||
it('has a working factory', () => {
|
||||
const integrations = GitHubIntegration.factory({
|
||||
config: ConfigReader.fromConfigs([
|
||||
{
|
||||
context: '',
|
||||
data: {
|
||||
integrations: {
|
||||
github: [
|
||||
{
|
||||
host: 'h.com',
|
||||
apiBaseUrl: 'a',
|
||||
rawBaseUrl: 'r',
|
||||
token: 't',
|
||||
},
|
||||
],
|
||||
config: new ConfigReader({
|
||||
integrations: {
|
||||
github: [
|
||||
{
|
||||
host: 'h.com',
|
||||
apiBaseUrl: 'a',
|
||||
rawBaseUrl: 'r',
|
||||
token: 't',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
}),
|
||||
});
|
||||
expect(integrations.length).toBe(2); // including default
|
||||
expect(integrations[0].predicate(new URL('https://h.com/a'))).toBe(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
describe('readGitHubIntegrationConfig', () => {
|
||||
function buildConfig(provider: Partial<GitHubIntegrationConfig>) {
|
||||
return ConfigReader.fromConfigs([{ context: '', data: provider }]);
|
||||
return new ConfigReader(provider);
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
@@ -80,9 +80,7 @@ describe('readGitHubIntegrationConfigs', () => {
|
||||
function buildConfig(
|
||||
providers: Partial<GitHubIntegrationConfig>[],
|
||||
): Config[] {
|
||||
return providers.map(provider =>
|
||||
ConfigReader.fromConfigs([{ context: '', data: provider }]),
|
||||
);
|
||||
return providers.map(provider => new ConfigReader(provider));
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
|
||||
@@ -20,21 +20,16 @@ import { GitLabIntegration } from './GitLabIntegration';
|
||||
describe('GitLabIntegration', () => {
|
||||
it('has a working factory', () => {
|
||||
const integrations = GitLabIntegration.factory({
|
||||
config: ConfigReader.fromConfigs([
|
||||
{
|
||||
context: '',
|
||||
data: {
|
||||
integrations: {
|
||||
gitlab: [
|
||||
{
|
||||
host: 'h.com',
|
||||
token: 't',
|
||||
},
|
||||
],
|
||||
config: new ConfigReader({
|
||||
integrations: {
|
||||
gitlab: [
|
||||
{
|
||||
host: 'h.com',
|
||||
token: 't',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
}),
|
||||
});
|
||||
expect(integrations.length).toBe(2); // including default
|
||||
expect(integrations[0].predicate(new URL('https://h.com/a'))).toBe(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
describe('readGitLabIntegrationConfig', () => {
|
||||
function buildConfig(data: Partial<GitLabIntegrationConfig>): Config {
|
||||
return ConfigReader.fromConfigs([{ context: '', data }]);
|
||||
return new ConfigReader(data);
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
@@ -60,9 +60,7 @@ describe('readGitLabIntegrationConfig', () => {
|
||||
|
||||
describe('readGitLabIntegrationConfigs', () => {
|
||||
function buildConfig(data: Partial<GitLabIntegrationConfig>[]): Config[] {
|
||||
return data.map(item =>
|
||||
ConfigReader.fromConfigs([{ context: '', data: item }]),
|
||||
);
|
||||
return data.map(item => new ConfigReader(item));
|
||||
}
|
||||
|
||||
it('reads all values', () => {
|
||||
|
||||
Reference in New Issue
Block a user