chore: added test for subpath azure

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2021-09-08 11:06:24 +02:00
parent e7b596fdae
commit bb7ce1c64c
2 changed files with 15 additions and 1 deletions
@@ -220,6 +220,21 @@ describe('AzureUrlReader', () => {
expect(indexMarkdownFile.toString()).toBe('# Test\n');
});
it('returns the wanted files from an archive when a subpath is passed through', async () => {
const response = await processor.readTree(
'https://dev.azure.com/organization/project/_git/repository?path=%2Fdocs',
);
expect(response.etag).toBe('123abc2');
const files = await response.files();
expect(files.length).toBe(1);
const indexMarkdownFile = await files[0].content();
expect(indexMarkdownFile.toString()).toBe('# Test\n');
});
it('creates a directory with the wanted files', async () => {
const response = await processor.readTree(
'https://dev.azure.com/organization/project/_git/repository',
@@ -21,6 +21,5 @@ const directoryNameRegex = /^[^\/]+\//;
// Removes the first segment of a forward-slash-separated path
export function stripFirstDirectoryFromPath(path: string): string {
console.log('stripFirstDirectoryPath path:', path);
return path.replace(directoryNameRegex, '');
}