Skip to content

Conversation

saseungmin
Copy link
Collaborator

@saseungmin saseungmin commented Nov 16, 2020

๐Ÿš€ ์Šคํ„ฐ๋”” ๋ชฉ๋ก ๊ตฌํ˜„ํ•˜๊ธฐ (ํ™ˆ ํ™”๋ฉด)

  • json-server๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
  • redux-toolkit์„ ์‚ฌ์šฉํ•˜์—ฌ redux ์ ์šฉํ•˜๊ธฐ
  • ์Šคํ„ฐ๋”” ๊ทธ๋ฃน ๋ฆฌ์ŠคํŠธ๊ฐ€ ํ™”๋ฉด์— ๋‚˜ํƒ€๋‚˜๊ฒŒ ํ•˜๊ธฐ
  • CSS๋Š” ์ œ์™ธํ•˜๊ณ  ๊ธฐ๋Šฅ ๊ตฌํ˜„๋จผ์ €.

- Cannot find module @emotion/react
- npm install @emotion/react
- Apply to react-router-dom
- Create StudyListPage
- Set Header component globally
- Fixed test name
@saseungmin saseungmin added the enhancement New feature or request label Nov 16, 2020
@saseungmin saseungmin mentioned this pull request Nov 17, 2020
11 tasks
- MainPage
- IntroducePage
- Add npm install axios, redux-devtools-extension, redux-logger, json-server
- Apply to Redux
- Apply to fake-server(json-server)
- Renders study group list
Comment on lines 9 to 11
{groups.map((group) => (
<li key={group.id}>{group.title}</li>
))}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • ์ถ”๊ฐ€์ ์ธ ์ž‘์—…์ด ํ•„์š”ํ•˜๋‹ค.
    (ํ˜„์žฌ๋Š” title๋งŒ ๋„์›Œ์ง€์ง€๋งŒ ๋งํฌ ์ถ”๊ฐ€ ๋ฐ ์ถ”๊ฐ€์ ์ธ group ์ƒ์„ธ ์ •๋ณด? ํ™”๋ฉด์— ๋‚˜ํƒ€๋‚˜๊ธฐ)
  • ์ปดํฌ๋„ŒํŠธ๋„ ๋ถ„๋ฆฌํ•ด์ฃผ์ž.

Comment on lines +13 to +19
axios.get.mockResolvedValue({ data: STUDY_GROUPS });

await expect(getStudyGroups()).resolves.toEqual(STUDY_GROUPS);

expect(axios.get).toHaveBeenCalledWith(
'http://localhost:3000/groups/',
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

describe('api', () => {
  describe('getStudyGroups', () => {
    beforeEach(() => {
      axios.get.mockResolvedValue({ data: STUDY_GROUPS });
    });

    it('returns study groups', async () => {
      const groups = await getStudyGroups();

      expect(groups).toEqual(STUDY_GROUPS);
    });
  });
});

@saseungmin
Copy link
Collaborator Author

  • ๊ณ„์† ํ•˜๋‹ค๋ณด๋‹ˆ๊นŒ ์ปค๋ฐ‹์„ ๊ณ„์† ๋ฏธ๋ค„๋ฒ„๋ ธ๋‹ค..
    ๊ทธ๋ž˜์„œ ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹์€ ํ•œ๊บผ๋ฒˆ์— ๋งŽ์€ ๋‚ด์šฉ์„ ์ปค๋ฐ‹ํ•˜๊ณ  ๋ง์•˜๋‹ค.
    ์‹ ๊ฒฝ์จ์„œ ์ปค๋ฐ‹์„ ํ•ด์•ผ๊ฒ ๋‹ค.

@saseungmin
Copy link
Collaborator Author

  • pull request๋ฅผ ์กฐ๊ธˆ ๋” ์ž‘์€ ๋‹จ์œ„๋กœ ๋‚˜๋ˆ ๋ณด์ž. ๐Ÿ˜…
    ๋„ˆ๋ฌด ํฌ๊ฒŒ ์žก์•„๋ฒ„๋ ธ๋‹ค.
    ๋‹ค์Œ PR๋ถ€ํ„ฐ๋Š” ๊ตฌํ˜„ํ•  ๊ธฐ๋Šฅ ๋‹จ์œ„๋กœ ๋‚˜๋ˆ ๋ด์•ผ๊ฒ ๋‹ค.

@saseungmin saseungmin merged commit e51e951 into CodeSoom:main Nov 18, 2020
Comment on lines +1 to +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;
};

Choose a reason for hiding this comment

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

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

const range = (length) => Array.from({ length }, (, i) => i);
const randomMonth = () => Math.floor((Math.random() * (11 - 1)) + 1);
const randomDay = () => Math.floor((Math.random() * (30 - 1)) + 1);

module.exports = () => {
  const groups = range(30)
    .map((i) => {
      const month = randomMonth();
      const day = 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 };
}

Comment on lines +13 to +19
axios.get.mockResolvedValue({ data: STUDY_GROUPS });

await expect(getStudyGroups()).resolves.toEqual(STUDY_GROUPS);

expect(axios.get).toHaveBeenCalledWith(
'http://localhost:3000/groups/',
);

Choose a reason for hiding this comment

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

describe('api', () => {
  describe('getStudyGroups', () => {
    beforeEach(() => {
      axios.get.mockResolvedValue({ data: STUDY_GROUPS });
    });

    it('returns study groups', async () => {
      const groups = await getStudyGroups();

      expect(groups).toEqual(STUDY_GROUPS);
    });
  });
});

@saseungmin saseungmin deleted the make_study_group_list branch July 5, 2021 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants