Play sound effects for notifications and events (#38)

Co-authored-by: HeavenOSK <heavenosk@gmail.com>
This commit is contained in:
Matt Rubens
2024-12-01 22:25:10 -05:00
committed by GitHub
parent ccb973ecaf
commit 4b74f290d4
14 changed files with 236 additions and 2 deletions

View File

@@ -4,10 +4,11 @@ import { ExtensionStateContextProvider, useExtensionState } from '../ExtensionSt
// Test component that consumes the context
const TestComponent = () => {
const { allowedCommands, setAllowedCommands } = useExtensionState()
const { allowedCommands, setAllowedCommands, soundEnabled } = useExtensionState()
return (
<div>
<div data-testid="allowed-commands">{JSON.stringify(allowedCommands)}</div>
<div data-testid="sound-enabled">{JSON.stringify(soundEnabled)}</div>
<button
data-testid="update-button"
onClick={() => setAllowedCommands(['npm install', 'git status'])}
@@ -29,6 +30,16 @@ describe('ExtensionStateContext', () => {
expect(JSON.parse(screen.getByTestId('allowed-commands').textContent!)).toEqual([])
})
it('initializes with soundEnabled set to false', () => {
render(
<ExtensionStateContextProvider>
<TestComponent />
</ExtensionStateContextProvider>
)
expect(JSON.parse(screen.getByTestId('sound-enabled').textContent!)).toBe(false)
})
it('updates allowedCommands through setAllowedCommands', () => {
render(
<ExtensionStateContextProvider>