Spaces:
Running
Running
File size: 962 Bytes
f2bee8a |
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 |
import 'web-audio-test-api';
import SharedAudioContext from '../../../src/lib/audio/shared-audio-context';
describe('Shared Audio Context', () => {
const audioContext = new AudioContext();
test('returns empty object without user gesture', () => {
const sharedAudioContext = new SharedAudioContext();
expect(sharedAudioContext).toMatchObject({});
});
test('returns AudioContext when mousedown is triggered', () => {
const sharedAudioContext = new SharedAudioContext();
const event = new Event('mousedown');
document.dispatchEvent(event);
expect(sharedAudioContext).toMatchObject(audioContext);
});
test('returns AudioContext when touchstart is triggered', () => {
const sharedAudioContext = new SharedAudioContext();
const event = new Event('touchstart');
document.dispatchEvent(event);
expect(sharedAudioContext).toMatchObject(audioContext);
});
});
|