Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Commit c86afda

Browse files
authored
feat(content): migrate おはスタ Dance Dance Revolution data (#647)
* feat(series): migrate oha-ster data to Markdown * test: remove content test * test: update snapshot
1 parent 7c57560 commit c86afda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+848
-3711
lines changed

__tests__/components/SearchBox.test.ts

Lines changed: 16 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,37 @@
1-
import { describe, expect, test, vi } from 'vitest'
1+
import { beforeEach, describe, expect, test, vi } from 'vitest'
22
import { ref } from 'vue'
33

4-
import SearchBox, { SearchSongResult } from '~~/components/SearchBox.vue'
5-
import boysFirst from '~~/content/1st-jp/boys-smiledk.json'
6-
import butterfly from '~~/content/1st-jp/butterfly.json'
7-
import littleBitch from '~~/content/1st-jp/little-bitch.json'
8-
import myFire from '~~/content/1st-jp/my-fire.json'
9-
import boysSecond from '~~/content/2nd/boys-smiledk.json'
4+
import SearchBox from '~~/components/SearchBox.vue'
5+
import useSongList from '~~/composables/useSongList'
106

117
import { mountAsync, plugins } from '../test-utils'
128

13-
const rawSongData = [boysFirst, butterfly, littleBitch, myFire, boysSecond].map(
14-
(d) => ({ slug: d.slug, name: d.name, artist: d.artist })
15-
)
9+
vi.mock('~~/composables/useSongList')
1610

1711
describe('components/SearchBox.vue', () => {
18-
const songs: SearchSongResult[] = [...rawSongData]
19-
songs.pop()
12+
const songs = [
13+
{ slug: 'boys-smiledk', name: 'BOYS', artist: 'smile. dk' },
14+
{ slug: 'butterfly', name: 'butterfly', artist: 'smile. dk' },
15+
{ slug: 'little-bitch', name: 'LITTLE BITCH', artist: 'THE SPECIALS' },
16+
{ slug: 'my-fire', name: 'MY FIRE', artist: 'X-TREME' }
17+
]
18+
beforeEach(() => {
19+
vi.mocked(useSongList).mockResolvedValue({ songs: ref(songs) } as any)
20+
})
2021

2122
describe('snapshot test', () => {
22-
test('{ isLoading: true, term: "" } renders loading state', async () => {
23-
// Arrange
24-
const data = ref([])
25-
const pending = ref(true)
26-
vi.mocked(useLazyAsyncData).mockResolvedValue({ data, pending } as any)
27-
28-
// Act
29-
const wrapper = await mountAsync(SearchBox, { global: { plugins } })
30-
31-
// Assert
32-
expect(wrapper.element).toMatchSnapshot()
33-
})
34-
test('{ isLoading: false, term: "" } renders input without autocomplete', async () => {
35-
// Arrange
36-
const data = ref([])
37-
const pending = ref(false)
38-
vi.mocked(useLazyAsyncData).mockResolvedValue({ data, pending } as any)
39-
40-
// Act
23+
test('{ term: "" } renders input without autocomplete', async () => {
24+
// Arrange - Act
4125
const wrapper = await mountAsync(SearchBox, { global: { plugins } })
4226

4327
// Assert
4428
expect(wrapper.element).toMatchSnapshot()
4529
})
4630
})
4731

48-
describe('useLazyAsyncData()', () => {
49-
test('calls with transform option', async () => {
50-
// Arrange
51-
const data = ref([])
52-
const pending = ref(false)
53-
vi.mocked(useLazyAsyncData).mockReset()
54-
vi.mocked(useLazyAsyncData).mockResolvedValue({ data, pending } as any)
55-
56-
// Act
57-
await mountAsync(SearchBox, { global: { plugins } })
58-
const transform = vi.mocked(useLazyAsyncData).mock.calls[0][2]?.transform!
59-
60-
// Assert
61-
expect(transform(rawSongData)).toStrictEqual(songs)
62-
})
63-
})
64-
6532
describe('term', () => {
6633
test('@change renders autocomplete', async () => {
67-
// Arrange
68-
const data = ref(songs)
69-
const pending = ref(false)
70-
vi.mocked(useLazyAsyncData).mockResolvedValue({ data, pending } as any)
71-
72-
// Act
34+
// Arrange - Act
7335
const wrapper = await mountAsync(SearchBox, { global: { plugins } })
7436
await wrapper.find('input.input').setValue('sm')
7537

@@ -81,9 +43,6 @@ describe('components/SearchBox.vue', () => {
8143
describe('autocomplete', () => {
8244
test('@select calls router.push("/songs/{id}")', async () => {
8345
// Arrange
84-
const data = ref(songs)
85-
const pending = ref(false)
86-
vi.mocked(useLazyAsyncData).mockResolvedValue({ data, pending } as any)
8746
const push = vi.fn()
8847
vi.mocked(useRouter).mockReturnValue({ push } as any)
8948

__tests__/components/__snapshots__/SearchBox.test.ts.snap

Lines changed: 41 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Vitest Snapshot v1
22

3-
exports[`components/SearchBox.vue > snapshot test > { isLoading: false, term: "" } renders input without autocomplete 1`] = `
3+
exports[`components/SearchBox.vue > snapshot test > { term: "" } renders input without autocomplete 1`] = `
44
<section>
5-
<transition-stub>
6-
<!--v-if-->
7-
</transition-stub>
85
<div
96
class="autocomplete control"
107
>
@@ -15,73 +12,6 @@ exports[`components/SearchBox.vue > snapshot test > { isLoading: false, term: ""
1512
aria-autocomplete="list"
1613
autocomplete="off"
1714
class="input"
18-
loading="false"
19-
placeholder="曲名 or アーティスト名"
20-
type="text"
21-
/>
22-
<span
23-
class="icon is-left"
24-
>
25-
<i
26-
class="mdi mdi-magnify mdi-24px"
27-
/>
28-
</span>
29-
<!--v-if-->
30-
<!--v-if-->
31-
</div>
32-
<transition-stub>
33-
<div
34-
class="dropdown-menu dropdown-content is-opened-bottom"
35-
is="div"
36-
style="display: none;"
37-
>
38-
<!--v-if-->
39-
40-
41-
<!--v-if-->
42-
43-
44-
45-
46-
<!--v-if-->
47-
<!--v-if-->
48-
</div>
49-
</transition-stub>
50-
</div>
51-
</section>
52-
`;
53-
54-
exports[`components/SearchBox.vue > snapshot test > { isLoading: true, term: "" } renders loading state 1`] = `
55-
<section>
56-
<transition-stub>
57-
<div
58-
class="o-load loading o-load--fullpage is-full-page"
59-
>
60-
<div
61-
class="o-load__overlay loading-overlay"
62-
/>
63-
64-
<span
65-
class="icon is-spin is-medium o-load__icon icon"
66-
>
67-
<i
68-
class="mdi mdi-loading mdi-36px"
69-
/>
70-
</span>
71-
72-
</div>
73-
</transition-stub>
74-
<div
75-
class="autocomplete control"
76-
>
77-
<div
78-
class="control has-icons-left"
79-
>
80-
<input
81-
aria-autocomplete="list"
82-
autocomplete="off"
83-
class="input"
84-
loading="true"
8515
placeholder="曲名 or アーティスト名"
8616
type="text"
8717
/>
@@ -106,6 +36,46 @@ exports[`components/SearchBox.vue > snapshot test > { isLoading: true, term: ""
10636
10737
<!--v-if-->
10838
39+
<div
40+
class="dropdown-item"
41+
is="div"
42+
>
43+
44+
<span>
45+
BOYS / smile. dk
46+
</span>
47+
48+
</div>
49+
<div
50+
class="dropdown-item"
51+
is="div"
52+
>
53+
54+
<span>
55+
butterfly / smile. dk
56+
</span>
57+
58+
</div>
59+
<div
60+
class="dropdown-item"
61+
is="div"
62+
>
63+
64+
<span>
65+
LITTLE BITCH / THE SPECIALS
66+
</span>
67+
68+
</div>
69+
<div
70+
class="dropdown-item"
71+
is="div"
72+
>
73+
74+
<span>
75+
MY FIRE / X-TREME
76+
</span>
77+
78+
</div>
10979
11080
11181

__tests__/components/content/Prose.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ describe('components/content/', () => {
2121
})
2222
expect(wrapper.element).toMatchSnapshot()
2323
})
24-
test('{ href: "#name" } renders <a>', () => {
24+
test('{ href: "https://example.com" } renders <a>', () => {
2525
const wrapper = mount(ProseA, {
2626
global,
2727
slots: { default: 'Link' },
28-
props: { href: '#name' }
28+
props: { href: 'https://example.com' }
2929
})
3030
expect(wrapper.element).toMatchSnapshot()
3131
})

__tests__/components/content/SongList.test.ts

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)