39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||
|
import * as giteaAssets from '../ts/classes.giteaassets.js';
|
||
|
|
||
|
let giteaAssetsInstance: giteaAssets.GiteaAssets;
|
||
|
|
||
|
tap.test('should create a GiteaAssets instance', async () => {
|
||
|
giteaAssetsInstance = new giteaAssets.GiteaAssets({
|
||
|
giteaBaseUrl: 'https://code.foss.global',
|
||
|
});
|
||
|
expect(giteaAssetsInstance).toBeInstanceOf(giteaAssets.GiteaAssets);
|
||
|
});
|
||
|
|
||
|
tap.test('should get files from a repository', async () => {
|
||
|
const files = await giteaAssetsInstance.getFiles('git.zone', 'cli', 'assets/templates/cli');
|
||
|
console.log(files);
|
||
|
|
||
|
for (const file of files) {
|
||
|
if (file.name.endsWith('cli.js')) {
|
||
|
console.log(atob(file.base64Content));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
expect(files).toBeTruthy();
|
||
|
});
|
||
|
|
||
|
tap.test('should get files from a repository', async () => {
|
||
|
const files = await giteaAssetsInstance.getFiles('git.zone', 'cli', 'assets/templates/cli/cli.js');
|
||
|
console.log(files);
|
||
|
|
||
|
for (const file of files) {
|
||
|
if (file.name.endsWith('cli.js')) {
|
||
|
console.log(atob(file.base64Content));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
expect(files).toBeTruthy();
|
||
|
});
|
||
|
|
||
|
tap.start();
|