BREAKING CHANGE(OpenData): Require explicit directory paths for OpenData (nogit/download/germanBusinessData); remove automatic .nogit creation; update HandelsRegister, JsonlDataProcessor, tests and README.

This commit is contained in:
2025-10-31 12:12:29 +00:00
parent fea83153ba
commit c806524e0c
9 changed files with 171 additions and 36 deletions

View File

@@ -1,12 +1,24 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as opendata from '../ts/index.js'
import * as paths from '../ts/paths.js';
import * as plugins from '../ts/plugins.js';
import { BusinessRecord } from '../ts/classes.businessrecord.js';
// Test configuration - explicit paths required
const testNogitDir = plugins.path.join(paths.packageDir, '.nogit');
const testDownloadDir = plugins.path.join(testNogitDir, 'downloads');
const testGermanBusinessDataDir = plugins.path.join(testNogitDir, 'germanbusinessdata');
const testOutputDir = plugins.path.join(testNogitDir, 'testoutput');
let testOpenDataInstance: opendata.OpenData;
tap.test('first test', async () => {
testOpenDataInstance = new opendata.OpenData();
testOpenDataInstance = new opendata.OpenData({
nogitDir: testNogitDir,
downloadDir: testDownloadDir,
germanBusinessDataDir: testGermanBusinessDataDir
});
expect(testOpenDataInstance).toBeInstanceOf(opendata.OpenData);
});
@@ -28,7 +40,7 @@ tap.test('should get the data for a specific company', async () => {
console.log(result);
await Promise.all(result.files.map(async (file) => {
await file.writeToDir('./.nogit/testoutput');
await file.writeToDir(testOutputDir);
}));

View File

@@ -3,6 +3,9 @@ import * as opendata from '../ts/index.js';
import * as paths from '../ts/paths.js';
import * as plugins from '../ts/plugins.js';
// Test configuration - explicit paths required
const testNogitDir = plugins.path.join(paths.packageDir, '.nogit');
// Test data
const testTickers = ['AAPL', 'MSFT', 'GOOGL'];
const invalidTicker = 'INVALID_TICKER_XYZ';
@@ -22,7 +25,7 @@ tap.test('should create StockPriceService instance', async () => {
tap.test('should create MarketstackProvider instance', async () => {
try {
// Create qenv and get API key
testQenv = new plugins.qenv.Qenv(paths.packageDir, paths.nogitDir);
testQenv = new plugins.qenv.Qenv(paths.packageDir, testNogitDir);
const apiKey = await testQenv.getEnvVarOnDemand('MARKETSTACK_COM_TOKEN');
marketstackProvider = new opendata.MarketstackProvider(apiKey, {