feat(core): Enhance commit fetching with caching, concurrency improvements, and dependency upgrades

This commit is contained in:
2025-04-25 20:44:32 +00:00
parent 6032867a13
commit e40e008429
7 changed files with 2620 additions and 1300 deletions

View File

@ -9,12 +9,22 @@ let testCodeFeed: codefeed.CodeFeed;
tap.test('first test', async () => {
const token = await testQenv.getEnvVarOnDemand('GITEA_TOKEN');
// console.log('token', token);
testCodeFeed = new codefeed.CodeFeed('https://code.foss.global', token);
// seed lastRunTimestamp to 1 year ago and enable in-memory caching for 1 year
const oneYearMs = 365 * 24 * 60 * 60 * 1000;
const oneYearAgo = new Date(Date.now() - oneYearMs).toISOString();
testCodeFeed = new codefeed.CodeFeed(
'https://code.foss.global',
token,
oneYearAgo,
{ enableCache: true, cacheWindowMs: oneYearMs, enableNpmCheck: false }
);
expect(testCodeFeed).toBeInstanceOf(codefeed.CodeFeed);
});
tap.test('fetchAllCommitsFromInstance', async () => {
const commits = await testCodeFeed.fetchAllCommitsFromInstance();
// log the actual results so we can inspect them
console.log('Fetched commits:', JSON.stringify(commits, null, 2));
expect(commits).toBeArray();
expect(commits.length).toBeGreaterThan(0);
// expect(commits[0]).toBeTypeofObject();