Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions __mocks__/react-redux.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
export const useDispatch = jest.fn();

export const useSelector = jest.fn();
22 changes: 22 additions & 0 deletions fake-server/createFakeData.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
/* eslint-disable no-plusplus */

module.exports = () => {
const data = { groups: [] };

for (let i = 0; i < 30; i++) {
const randomMonth = Math.floor((Math.random() * (11 - 1)) + 1);
const randomDay = Math.floor((Math.random() * (30 - 1)) + 1);

data.groups.push({
id: i,
moderatorId: `user${i}`,
title: `์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ${i}`,
applyStartDate: `2020-${randomMonth}-${randomDay}`,
applyEndDate: '2020-12-3',
personnel: randomMonth,
contents: `์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.${i}`,
tags: ['JavaScript', 'React', 'Algorithm'],
});
}
return data;
};
Comment on lines +1 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map์ด๋ผ๋Š” ๋” ๋ช…์‹œ์ ์ธ ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด์„œ ํ‘œํ˜„ํ•ด์ฃผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”\

constrange=(length)=>Array.from({ length },(,i)=>i);constrandomMonth=()=>Math.floor((Math.random()*(11-1))+1);constrandomDay=()=>Math.floor((Math.random()*(30-1))+1);module.exports=()=>{constgroups=range(30).map((i)=>{constmonth=randomMonth();constday=randomDay();return{id: i,moderatorId: `user${i}`,title: `์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ${i}`,applyStartDate: `2020-${month}-${day}`,applyEndDate: '2020-12-3',personnel: month,contents: `์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.${i}`,tags: ['JavaScript','React','Algorithm'],}});return{ groups };}

155 changes: 155 additions & 0 deletions fake-server/db.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
{
"groups": [
{
"id": 1,
"moderatorId": "user1",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 1",
"applyStartDate": "2020-7-10",
"applyEndDate": "2020-12-3",
"personnel": 7,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.1",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 2,
"moderatorId": "user2",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 2",
"applyStartDate": "2020-10-18",
"applyEndDate": "2020-12-3",
"personnel": 10,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.2",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 3,
"moderatorId": "user3",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 3",
"applyStartDate": "2020-2-18",
"applyEndDate": "2020-12-3",
"personnel": 2,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.3",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 4,
"moderatorId": "user4",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 4",
"applyStartDate": "2020-8-14",
"applyEndDate": "2020-12-3",
"personnel": 8,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.4",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 5,
"moderatorId": "user5",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 5",
"applyStartDate": "2020-4-2",
"applyEndDate": "2020-12-3",
"personnel": 4,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.5",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 6,
"moderatorId": "user6",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 6",
"applyStartDate": "2020-9-25",
"applyEndDate": "2020-12-3",
"personnel": 9,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.6",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 7,
"moderatorId": "user7",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 7",
"applyStartDate": "2020-8-20",
"applyEndDate": "2020-12-3",
"personnel": 8,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.7",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 8,
"moderatorId": "user8",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 8",
"applyStartDate": "2020-8-25",
"applyEndDate": "2020-12-3",
"personnel": 8,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.8",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 9,
"moderatorId": "user9",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 9",
"applyStartDate": "2020-2-11",
"applyEndDate": "2020-12-3",
"personnel": 2,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.9",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
},
{
"id": 10,
"moderatorId": "user10",
"title": "์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 10",
"applyStartDate": "2020-3-2",
"applyEndDate": "2020-12-3",
"personnel": 3,
"contents": "์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.10",
"tags": [
"JavaScript",
"React",
"Algorithm"
]
}
],
"users": [
{
"id": 1,
"password": "1234",
"userId": "seung",
"groupId": 1
}
],
"profile": {
"name": "typicode"
}
}
28 changes: 28 additions & 0 deletions fixtures/study-groups.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
const studyGroups = [
{
id: 1,
moderatorId: 'user1',
title: '์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 1',
personnel: 7,
contents: '์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.1',
tags: [
'JavaScript',
'React',
'Algorithm',
],
},
{
id: 2,
moderatorId: 'user2',
title: '์Šคํ„ฐ๋””๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. 2',
personnel: 10,
contents: '์šฐ๋ฆฌ๋Š” ์ด๊ฒƒ์ €๊ฒƒ ํ•ฉ๋‹ˆ๋‹ค.2',
tags: [
'JavaScript',
'React',
'Algorithm',
],
},
];

export default studyGroups;
Loading