clearup
Signed-off-by: kim5566 <28945404+kim5566@users.noreply.github.com>
This commit is contained in:
@@ -252,7 +252,7 @@ describe('TodoScmReader', () => {
|
||||
files: async () => [
|
||||
{
|
||||
content: async () => Buffer.from('// TODO: my-todo', 'utf8'),
|
||||
path: 'my-folder/my-file.js',
|
||||
path: '',
|
||||
},
|
||||
],
|
||||
} as ReadTreeResponse);
|
||||
@@ -261,16 +261,7 @@ describe('TodoScmReader', () => {
|
||||
url: 'https://github.com/backstage/backstage/catalog-info.yaml',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
items: [
|
||||
{
|
||||
text: 'my-todo',
|
||||
tag: 'TODO',
|
||||
lineNumber: 1,
|
||||
repoFilePath: 'my-folder/my-file.js',
|
||||
viewUrl:
|
||||
'https://github.com/backstage/backstage/my-folder/my-file.js#L1',
|
||||
},
|
||||
],
|
||||
items: [],
|
||||
});
|
||||
expect(reader.readTree).toHaveBeenCalledTimes(1);
|
||||
expect(reader.readTree).toHaveBeenCalledWith(
|
||||
|
||||
@@ -92,12 +92,7 @@ export class TodoScmReader implements TodoReader {
|
||||
}
|
||||
|
||||
const cacheItem = this.cache.get(url);
|
||||
const filePathFilter = this.filePathFilter;
|
||||
const newRead = this.doReadTodos(
|
||||
{ url },
|
||||
filePathFilter,
|
||||
cacheItem?.etag,
|
||||
).catch(error => {
|
||||
const newRead = this.doReadTodos({ url }, cacheItem?.etag).catch(error => {
|
||||
if (cacheItem && error.name === 'NotModifiedError') {
|
||||
return cacheItem;
|
||||
}
|
||||
@@ -116,11 +111,10 @@ export class TodoScmReader implements TodoReader {
|
||||
|
||||
private async doReadTodos(
|
||||
options: ReadTodosOptions,
|
||||
filePathFilter: (filePath: string) => boolean,
|
||||
etag?: string,
|
||||
): Promise<CacheItem> {
|
||||
const { url } = options;
|
||||
|
||||
const filePathFilter = this.filePathFilter;
|
||||
const tree = await this.reader.readTree(url, {
|
||||
etag,
|
||||
filter(filePath, info) {
|
||||
|
||||
Reference in New Issue
Block a user