cameraTestMessage.test.ts 1.0 KB

123456789101112131415161718192021222324252627
  1. import { describe, it, expect } from 'vitest';
  2. import i18n from '../../i18n';
  3. import { cameraTestSuccessMessage } from '../../utils/cameraTestMessage';
  4. const t = i18n.getFixedT('en');
  5. describe('cameraTestSuccessMessage', () => {
  6. it('puts the resolution in brackets after the word', () => {
  7. expect(cameraTestSuccessMessage({ resolution: '640x480' }, t)).toBe('Camera connected (640x480)');
  8. });
  9. it('leaves it out when the frame had none', () => {
  10. expect(cameraTestSuccessMessage({}, t)).toBe('Camera connected');
  11. });
  12. it('names a shared capture', () => {
  13. expect(cameraTestSuccessMessage({ resolution: '640x480', coalesced: true }, t)).toBe(
  14. 'Camera connected (640x480) (shared with a capture already running)',
  15. );
  16. });
  17. it('names the live view, which wins over a shared capture', () => {
  18. expect(cameraTestSuccessMessage({ resolution: '640x480', coalesced: true, live_view: true }, t)).toBe(
  19. 'Camera works (640x480) (frame from the live view, which is using the camera)',
  20. );
  21. });
  22. });