diff --git a/README.md b/README.md index 9dabfa5..1baa1af 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # shared -[![Test Coverage](https://img.shields.io/badge/coverage-38.11%25-yellow.svg)](https://github.com/ummgoban/shared) - ummgoban 공통 패키지입니다. - ummgoban 도메인에서 공용으로 사용하는 type, utils, http client, hook 등을 관리합니다. @@ -32,24 +30,11 @@ NPM_TOKEN=ghp_... ## test ```bash -yarn test # 테스트 실행 -yarn test:watch # 테스트 실시간 감시 모드 -yarn test:coverage # 테스트 커버리지 보고서 생성 +yarn test +yarn test:watch +yarn test:coverage ``` -## 테스트 커버리지 - -현재 프로젝트의 테스트 커버리지는 38.11%입니다. 커버리지 보고서는 `coverage` 디렉토리에서 확인할 수 있습니다. - -```bash -yarn test:coverage # 커버리지 보고서 생성 후 coverage/index.html 확인 -``` - -커버리지 보고서에서 제외된 파일: -- `**/index.ts` 파일들 -- 테스트 파일들 (`*.spec.ts`, `*.test.ts`) -- 타입 정의 파일들 (`*.d.ts`) - ## dev ```bash diff --git a/src/lib/constants/index.ts b/src/lib/constants/index.ts new file mode 100644 index 0000000..390dd4c --- /dev/null +++ b/src/lib/constants/index.ts @@ -0,0 +1,3 @@ +import {OAUTH_PROVIDER, convertOAuthProviderToKorean} from './oauth-provider.const'; + +export {OAUTH_PROVIDER, convertOAuthProviderToKorean}; diff --git a/src/lib/constants/oauth-provider.const.spec.ts b/src/lib/constants/oauth-provider.const.spec.ts new file mode 100644 index 0000000..8399f21 --- /dev/null +++ b/src/lib/constants/oauth-provider.const.spec.ts @@ -0,0 +1,10 @@ +import {convertOAuthProviderToKorean} from './oauth-provider.const'; + +describe('convertOAuthProviderToKorean', () => { + it('should convert OAuth provider to Korean', () => { + expect(convertOAuthProviderToKorean('KAKAO')).toBe('카카오'); + expect(convertOAuthProviderToKorean('NAVER')).toBe('네이버'); + expect(convertOAuthProviderToKorean('APPLE')).toBe('애플'); + expect(convertOAuthProviderToKorean('BASIC')).toBe('일반회원'); + }); +}); diff --git a/src/lib/constants/oauth-provider.const.ts b/src/lib/constants/oauth-provider.const.ts new file mode 100644 index 0000000..fa00130 --- /dev/null +++ b/src/lib/constants/oauth-provider.const.ts @@ -0,0 +1,10 @@ +import {SessionType} from '../types'; + +export const OAUTH_PROVIDER: Record = { + KAKAO: '카카오', + NAVER: '네이버', + APPLE: '애플', + BASIC: '일반회원', +}; + +export const convertOAuthProviderToKorean = (provider: SessionType['OAuthProvider']) => OAUTH_PROVIDER[provider]; diff --git a/src/lib/index.ts b/src/lib/index.ts index 689a90e..a7a8c4f 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,3 +1,6 @@ +// constants +export * from './constants'; + // utils export * from './utils';