Add support for connecting microphone on card load.
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest';
|
||||
import { log } from '../../src/utils/debug.js';
|
||||
|
||||
describe('log', () => {
|
||||
const spy = vi.spyOn(global.console, 'debug').mockReturnValue(undefined);
|
||||
afterAll(() => {
|
||||
vi.resetAllMocks();
|
||||
});
|
||||
it('should do nothing without debug logging set', () => {
|
||||
const spy = vi.spyOn(global.console, 'debug');
|
||||
log({}, 'foo');
|
||||
expect(spy).not.toBeCalled();
|
||||
});
|
||||
it('should log debug when appropriately configured', () => {
|
||||
const spy = vi.spyOn(global.console, 'debug');
|
||||
log({ debug: { logging: true } }, 'foo');
|
||||
expect(spy).toBeCalledWith('foo');
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ describe('MicrophoneController', () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.resetAllMocks();
|
||||
vi.unstubAllGlobals;
|
||||
});
|
||||
|
||||
@@ -48,6 +49,8 @@ describe('MicrophoneController', () => {
|
||||
});
|
||||
|
||||
it('should be forbidden when permission denied', async () => {
|
||||
// Don't actually log messages to the console during the test.
|
||||
vi.spyOn(global.console, 'warn').mockReturnValue(undefined);
|
||||
const controller = new MicrophoneController();
|
||||
navigatorMock.mediaDevices.getUserMedia.mockRejectedValue(new Error());
|
||||
await controller.connect();
|
||||
|
||||
Reference in New Issue
Block a user