-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproperties.spec.ts
More file actions
36 lines (29 loc) · 1011 Bytes
/
properties.spec.ts
File metadata and controls
36 lines (29 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { ComponentProps } from 'svelte'
import { render, screen } from '@testing-library/svelte'
import { describe, expect, it } from 'vitest'
import Subject from '../properties.svelte'
const renderSubject = (props: Partial<ComponentProps<typeof Subject>> = {}) =>
render(Subject, {
supportedCodecs: [],
sampleRateHz: 0,
numChannels: 0,
...props,
})
describe('AudioInput Properties', () => {
it('displays supported codecs', () => {
renderSubject({ supportedCodecs: ['mp3', 'pcm16'] })
expect(screen.getByText('mp3, pcm16')).toBeInTheDocument()
})
it('displays None when no codecs are supported', () => {
renderSubject({ supportedCodecs: [] })
expect(screen.getByText('None')).toBeInTheDocument()
})
it('displays sample rate', () => {
renderSubject({ sampleRateHz: 48000 })
expect(screen.getByText('48000 Hz')).toBeInTheDocument()
})
it('displays number of channels', () => {
renderSubject({ numChannels: 2 })
expect(screen.getByText('2')).toBeInTheDocument()
})
})