From c15aa96e47ee4e5908628b75be56dc82bb517418 Mon Sep 17 00:00:00 2001 From: Yeonjeong Choi Date: Wed, 1 Mar 2023 16:23:53 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EB=93=9C=20=EB=AD=89=EC=B9=98?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C/=EC=B4=88=EA=B8=B0=ED=99=94/=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=9D=84=20=EB=B3=80=EA=B2=BD=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8B=A4.=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ๐Ÿงช LearnsetList test ์ถ”๊ฐ€ * โœจ Dashboard์—์„œ ์นด๋“œ ๋ญ‰์น˜ ๋ชฉ๋ก ๋ Œ๋”๋ง --- src/components/LearnsetList.vue | 77 +++++++++++++++++++ src/components/__tests__/LearnsetList.spec.ts | 36 +++++++++ src/views/DashboardView.vue | 48 +++++++++--- 3 files changed, 150 insertions(+), 11 deletions(-) create mode 100644 src/components/LearnsetList.vue create mode 100644 src/components/__tests__/LearnsetList.spec.ts diff --git a/src/components/LearnsetList.vue b/src/components/LearnsetList.vue new file mode 100644 index 0000000..a13e472 --- /dev/null +++ b/src/components/LearnsetList.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/__tests__/LearnsetList.spec.ts b/src/components/__tests__/LearnsetList.spec.ts new file mode 100644 index 0000000..0d0a001 --- /dev/null +++ b/src/components/__tests__/LearnsetList.spec.ts @@ -0,0 +1,36 @@ +import vuetify from '@/utils/setupVuetify'; +import { render } from '@testing-library/vue'; +import LearnsetList from '@/components/LearnsetList.vue'; + +describe(`LearnsetList Component`, () => { + it(`์นด๋“œ ๋ญ‰์น˜ ์ด๋ฆ„๊ณผ ์‚ญ์ œ ๋ฒ„ํŠผ์ด ๋ Œ๋”๋ง๋œ๋‹ค.`, () => { + const learnsets = [ + { + id: '', + name: '์นด๋“œ ๋ญ‰์น˜ 1', + created: 0, + cards: [], + }, + { + id: '', + name: '์นด๋“œ ๋ญ‰์น˜ 2', + created: 0, + cards: [], + }, + ]; + + const { getByText, getAllByRole } = render(LearnsetList, { + global: { + plugins: [vuetify], + }, + props: { + learnsets, + }, + }); + + expect(getByText(learnsets[0].name)).toBeInTheDocument(); + expect(getByText(learnsets[1].name)).toBeInTheDocument(); + + expect(getAllByRole('button').length).toBe(2); + }); +}); diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue index 46b942d..97784da 100644 --- a/src/views/DashboardView.vue +++ b/src/views/DashboardView.vue @@ -1,14 +1,31 @@ @@ -18,6 +35,7 @@ import type { File } from '@/types/interfaces'; import BaseButton from '@/components/BaseButton.vue'; import AddLearnsetModal from '@/components/AddLearnsetModal.vue'; +import LearnsetList from '@/components/LearnsetList.vue'; import { ref, reactive } from 'vue'; @@ -28,8 +46,11 @@ import { MutationTypes } from '@/store/mutations'; import { useMarkdownIt } from '@/plugins/markdownit'; import { useRouter } from 'vue-router'; +import type { MyStore } from '@/store/types'; -const store = useStore(); +const store: MyStore = useStore(); + +const learnsets = store.state.learnsets; const md = useMarkdownIt(); @@ -75,4 +96,9 @@ const addLearnset = (name: string) => { }; - +