Skip to content

Commit d84bdce

Browse files
committed
refactor: Remove command
1 parent a9daaea commit d84bdce

File tree

6 files changed

+10
-19
lines changed

6 files changed

+10
-19
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ For more information on how to this works with other frontends/backends, head ov
1616
- React
1717
- Recoil
1818
- Vite
19-
- Jest
2019
- ESLint
2120

2221
## How it works

src/application/api/article.service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ export class ArticleService implements ArticleServiceInterface, TagService {
111111
const envelope = await this.http
112112
.get(`${this.config.apiBase}/tags`)
113113
.json<{ tags: Tag[] }>();
114-
return envelope.tags;
114+
115+
return envelope.tags.filter(
116+
(x: string) => x.replace(/[^\u0020-\u007E]/g, '').length > 1,
117+
);
115118
}
116119
}

src/application/article/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ export type { ArticleFindManyArgs } from './article-find-many-args';
55
export type { ArticleList } from './article-list';
66
export type { ArticleServiceInterface } from './article-service.interface';
77
export type { SingleArticle } from './single-article';
8-
export { TagListHandler } from './tag-list.handler';

src/application/article/tag-list.handler.ts

-13
This file was deleted.

src/pages/App.spec.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { render, waitFor } from '@testing-library/react';
44
import { mock } from 'jest-mock-extended';
55
import { injector } from 'njct';
66
import React from 'react';
7+
import { Ok } from 'rsts';
78

89
import { App } from './App';
910

@@ -18,7 +19,7 @@ beforeEach(() => {
1819
injector.provide('articleservice', () => articleService);
1920
injector.provide('sessionservice', () => sessionService);
2021

21-
articleService.findMany.mockResolvedValue({ articles: [] as any, articlesCount: 0 });
22+
articleService.findMany.mockResolvedValue(Ok({ articles: [], articlesCount: 0 }));
2223
});
2324

2425
afterAll(() => {

src/pages/home/PopularTags.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { TagListHandler } from '@application/article';
21
import { useRequest } from 'ahooks';
2+
import { inject } from 'njct';
33
import React from 'react';
4+
import { TagService } from '@application/tag';
45

56
export function PopularTags(): JSX.Element {
67
const { data: tagList, loading } = useRequest(async () => {
7-
return new TagListHandler().execute();
8+
const tagService = inject<TagService>('tagservice');
9+
return tagService.getAllTags();
810
});
911

1012
return (

0 commit comments

Comments
 (0)