Skip to content

Commit 63e1817

Browse files
committed
test: ✅ add mount tests
1 parent dae09b6 commit 63e1817

16 files changed

+276
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import AnchorFm from '$lib/components/anchor-fm.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('AnchorFm', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', async () => {
15+
const { container } = render(AnchorFm)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Buzzsprout from '$lib/components/buzzsprout.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('Buzzsprout', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', async () => {
15+
const { container } = render(Buzzsprout)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import CodePen from '$lib/components/code-pen.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('CodePen', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', async () => {
15+
const { container } = render(CodePen)
16+
expect(container).toBeTruthy()
17+
})
18+
})

src/lib/components/deezer.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Deezer from '$lib/components/deezer.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('Deezer', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', async () => {
15+
const { container } = render(Deezer)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import GeneralObserver from '$lib/components/general-observer.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('General Observer', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(GeneralObserver)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import GenericEmbed from '$lib/components/generic-embed.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('GenericEmbed', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(GenericEmbed)
16+
expect(container).toBeTruthy()
17+
})
18+
})

src/lib/components/gist.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Gist from '$lib/components/gist.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('Gist', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(Gist)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import SimpleCast from '$lib/components/simple-cast.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('SimpleCast', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(SimpleCast)
16+
expect(container).toBeTruthy()
17+
})
18+
})

src/lib/components/slides.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Slides from '$lib/components/slides.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('Slides', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(Slides)
16+
expect(container).toBeTruthy()
17+
})
18+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import SoundCloud from '$lib/components/sound-cloud.svelte'
2+
import { cleanup, render } from '@testing-library/svelte'
3+
import { afterEach, describe, expect, it, vi } from 'vitest'
4+
5+
globalThis.IntersectionObserver = vi.fn(() => ({
6+
observe: () => null,
7+
unobserve: () => null,
8+
disconnect: () => null,
9+
})) as unknown as typeof globalThis.IntersectionObserver
10+
11+
describe('SoundCloud', () => {
12+
afterEach(() => cleanup())
13+
14+
it('mounts', () => {
15+
const { container } = render(SoundCloud)
16+
expect(container).toBeTruthy()
17+
})
18+
})

0 commit comments

Comments
 (0)