Skip to content

Commit 6a3146d

Browse files
authored
Merge branch 'main' into 909-ldap-user-group-confirmation
2 parents 709441d + 72d43e4 commit 6a3146d

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<br />
2525

26-
[![FINOS - Incubating](https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-incubating.svg)](https://community.finos.org/docs/governance/Software-Projects/stages/incubating)
26+
[![FINOS - Active](https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-active.svg)](https://community.finos.org/docs/governance/Software-Projects/stages/active)
2727
[![NPM](https://img.shields.io/npm/v/@finos/git-proxy?colorA=00C586&colorB=000000)](https://www.npmjs.com/package/@finos/git-proxy)
2828
[![Build](https://img.shields.io/github/actions/workflow/status/finos/git-proxy/ci.yml?branch=main&label=CI&logo=github&colorA=00C586&colorB=000000)](https://github.com/finos/git-proxy/actions/workflows/ci.yml)
2929
[![codecov](https://codecov.io/gh/finos/git-proxy/branch/main/graph/badge.svg)](https://codecov.io/gh/finos/git-proxy)

test/ConfigLoader.test.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3+
import { configFile } from '../src/config/file';
34
import { expect } from 'chai';
45
import { ConfigLoader } from '../src/config/ConfigLoader';
56
import { isValidGitUrl, isValidPath, isValidBranchName } from '../src/config/ConfigLoader';
@@ -23,6 +24,18 @@ describe('ConfigLoader', () => {
2324
fs.rmSync(tempDir, { recursive: true });
2425
}
2526
sinon.restore();
27+
configLoader?.stop();
28+
});
29+
30+
after(async () => {
31+
// reset config to default after all tests have run
32+
console.log(`Restoring config to defaults from file ${configFile}`);
33+
configLoader = new ConfigLoader({});
34+
await configLoader.loadFromFile({
35+
type: 'file',
36+
enabled: true,
37+
path: configFile,
38+
});
2639
});
2740

2841
describe('loadFromFile', () => {
@@ -168,7 +181,7 @@ describe('ConfigLoader', () => {
168181

169182
describe('initialize', () => {
170183
it('should initialize cache directory using env-paths', async () => {
171-
const configLoader = new ConfigLoader({});
184+
configLoader = new ConfigLoader({});
172185
await configLoader.initialize();
173186

174187
// Check that cacheDir is set and is a string
@@ -190,7 +203,7 @@ describe('ConfigLoader', () => {
190203
});
191204

192205
it('should create cache directory if it does not exist', async () => {
193-
const configLoader = new ConfigLoader({});
206+
configLoader = new ConfigLoader({});
194207
await configLoader.initialize();
195208

196209
// Check if directory exists
@@ -214,7 +227,7 @@ describe('ConfigLoader', () => {
214227
},
215228
};
216229

217-
const configLoader = new ConfigLoader(mockConfig);
230+
configLoader = new ConfigLoader(mockConfig);
218231
const spy = sinon.spy(configLoader, 'reloadConfiguration');
219232
await configLoader.start();
220233

@@ -235,7 +248,7 @@ describe('ConfigLoader', () => {
235248
},
236249
};
237250

238-
const configLoader = new ConfigLoader(mockConfig);
251+
configLoader = new ConfigLoader(mockConfig);
239252
configLoader.reloadTimer = setInterval(() => {}, 1000);
240253
await configLoader.start();
241254

@@ -257,7 +270,7 @@ describe('ConfigLoader', () => {
257270
},
258271
};
259272

260-
const configLoader = new ConfigLoader(mockConfig);
273+
configLoader = new ConfigLoader(mockConfig);
261274
const spy = sinon.spy(configLoader, 'reloadConfiguration');
262275
await configLoader.start();
263276

@@ -281,7 +294,7 @@ describe('ConfigLoader', () => {
281294
},
282295
};
283296

284-
const configLoader = new ConfigLoader(mockConfig);
297+
configLoader = new ConfigLoader(mockConfig);
285298
configLoader.reloadTimer = setInterval(() => {}, 1000);
286299
expect(configLoader.reloadTimer).to.not.be.null;
287300

@@ -291,7 +304,6 @@ describe('ConfigLoader', () => {
291304
});
292305

293306
describe('loadRemoteConfig', () => {
294-
let configLoader;
295307
beforeEach(async () => {
296308
const configFilePath = path.join(__dirname, '..', 'proxy.config.json');
297309
const config = JSON.parse(fs.readFileSync(configFilePath, 'utf-8'));
@@ -379,7 +391,7 @@ describe('ConfigLoader', () => {
379391
branch: 'main',
380392
enabled: true,
381393
};
382-
394+
383395
try {
384396
await configLoader.loadFromSource(source);
385397
throw new Error('Expected error was not thrown');

0 commit comments

Comments
 (0)