backend-common: make ReadTreeResponse.files async

This commit is contained in:
Patrik Oldsberg
2020-11-12 10:37:04 +01:00
parent 752808090b
commit e74422b4d8
4 changed files with 5 additions and 5 deletions
@@ -272,7 +272,7 @@ describe('GithubUrlReader', () => {
['mkdocs.yml', 'docs'],
);
const files = response.files();
const files = await response.files();
const mkDocsFile = await files[0].content();
const indexMarkdownFile = await files[1].content();
@@ -286,7 +286,7 @@ export class GithubUrlReader implements UrlReader {
// @ts-ignore Typescript doesn't consider .pipe a method on ReadableStream. Don't know why.
repoArchive.body?.pipe(parser).on('finish', () => {
resolve({
files: () => {
files: async () => {
return files;
},
archive: () => {
+1 -1
View File
@@ -49,7 +49,7 @@ export type File = {
};
export type ReadTreeResponse = {
files(): File[];
files(): Promise<File[]>;
archive(): Promise<Buffer>;
dir(outDir?: string): Promise<string>;
};
+2 -2
View File
@@ -30,7 +30,7 @@ describe('getDocFilesFromRepository', () => {
dir: async () => {
return '/tmp/testfolder';
},
files: () => {
files: async () => {
return [];
},
archive: async () => {
@@ -78,7 +78,7 @@ describe('getDocFilesFromRepository', () => {
dir: async () => {
return '/tmp/testfolder';
},
files: () => {
files: async () => {
return [];
},
archive: async () => {