Skip to content

Commit

Permalink
refactor: 사용하지 않는 코드 삭제 (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
saseungmin authored Nov 1, 2024
1 parent aead721 commit d22539f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 51 deletions.
2 changes: 0 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"dayjs": "1.11.11",
"framer-motion": "11.2.10",
"next": "14.2.15",
"qs": "6.12.1",
"react": "18.3.1",
"react-countup": "6.5.3",
"react-dom": "18.3.1",
Expand Down Expand Up @@ -74,7 +73,6 @@
"@types/jest-plugin-context": "2.9.7",
"@types/node": "20",
"@types/prop-types": "^15",
"@types/qs": "^6",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
"@types/react-responsive-masonry": "^2",
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/molecules/Tags/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { useCallback, useMemo } from 'react';
import { Route } from 'next';
import { useRouter, useSearchParams } from 'next/navigation';

import { paramsSerializer } from '@dnd-academy/core';
import clsx from 'clsx';

import Tag from '@/components/atoms/Tag';
import { paramsSerializer, sortFlagsDescending } from '@/utils';
import { sortFlagsDescending } from '@/utils';

import styles from './index.module.scss';

Expand Down
25 changes: 1 addition & 24 deletions apps/web/src/utils/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
import qs from 'qs';

import { checkNumber, paramsSerializer } from '.';

describe('paramsSerializer', () => {
it('"qs.stringify"를 호출해야만 한다', () => {
const qsSpyOn = jest.spyOn(qs, 'stringify');
const params = {
param1: 'apple',
param2: 'banana',
param3: 'orange',
};

const result = paramsSerializer(params);

expect(result).toBe('param1=apple&param2=banana&param3=orange');
expect(qsSpyOn).toHaveBeenCalledWith(params, {
indices: false,
arrayFormat: 'comma',
});

qsSpyOn.mockRestore();
});
});
import { checkNumber } from '.';

describe('checkNumber', () => {
describe('value가 null인 경우', () => {
Expand Down
22 changes: 0 additions & 22 deletions apps/web/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
import type { Entries, RequiredNonNullableObject } from '@dnd-academy/core';
import dayjs from 'dayjs';
import qs from 'qs';

const CACHE_MINUTE = 5;

export const paramsSerializer = <T>(params: T): string => qs.stringify(params, {
arrayFormat: 'comma',
indices: false,
});

export const isSSR = typeof window === 'undefined';

export const getCacheDate = (cacheTime = CACHE_MINUTE) => {
const date = dayjs().format('YYYY-MM-DD-HH');
const currentMin = dayjs().get('minute');
const modMin = dayjs().get('minute') % cacheTime;
const minute = modMin === 0 ? currentMin : currentMin - modMin;

return {
date: `${date}-${minute}`,
};
};

export const getEntries = <T extends object>(obj: T) => {
const entries = Object.entries(obj) as Entries<T>;
Expand Down
2 changes: 0 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18939,7 +18939,6 @@ __metadata:
"@types/jest-plugin-context": "npm:2.9.7"
"@types/node": "npm:20"
"@types/prop-types": "npm:^15"
"@types/qs": "npm:^6"
"@types/react": "npm:18.3.2"
"@types/react-dom": "npm:18.3.0"
"@types/react-responsive-masonry": "npm:^2"
Expand Down Expand Up @@ -18971,7 +18970,6 @@ __metadata:
jest-plugin-context: "npm:2.9.0"
next: "npm:14.2.15"
prop-types: "npm:15.8.1"
qs: "npm:6.12.1"
react: "npm:18.3.1"
react-countup: "npm:6.5.3"
react-dom: "npm:18.3.1"
Expand Down

0 comments on commit d22539f

Please sign in to comment.