- Closes #2556 - Closes #2450 **Key intended features:** - go2rtc compatible - 100% test coverage to significantly improve ability to test, maintain and work around browser weirdnesses (e.g. Safari). - Written from the ground up in the style of the rest of the project. **To use:** - Change `live_provider` from `go2rtc` to `go2rtc-experimental`.
30 lines
1001 B
TypeScript
30 lines
1001 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { isServerErrorForMode } from '../../../../../../src/components-lib/live/providers/go2rtc-experimental/utils/messages';
|
|
|
|
describe('isServerErrorForMode', () => {
|
|
it('should match an error for the mode', () => {
|
|
expect(isServerErrorForMode({ type: 'error', value: 'mse: not found' }, 'mse')).toBe(
|
|
true,
|
|
);
|
|
});
|
|
|
|
it('should not match an error for another mode', () => {
|
|
expect(isServerErrorForMode({ type: 'error', value: 'webrtc: failed' }, 'mse')).toBe(
|
|
false,
|
|
);
|
|
});
|
|
|
|
it('should not match a non-error message', () => {
|
|
expect(isServerErrorForMode({ type: 'mse', value: 'codecs' }, 'mse')).toBe(false);
|
|
});
|
|
|
|
it('should not match an error with a non-string value', () => {
|
|
expect(isServerErrorForMode({ type: 'error', value: 42 }, 'mse')).toBe(false);
|
|
});
|
|
|
|
it('should not match an error with no value', () => {
|
|
expect(isServerErrorForMode({ type: 'error' }, 'mse')).toBe(false);
|
|
});
|
|
});
|