feat(core): Enhance commit fetching with caching, concurrency improvements, and dependency upgrades
This commit is contained in:
12
test/test.ts
12
test/test.ts
@ -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();
|
||||
|
Reference in New Issue
Block a user