prometheus

Форк
0
/
withStartingIndicator.test.tsx 
68 строк · 2.1 Кб
1
import * as React from 'react';
2
import { shallow } from 'enzyme';
3
import { WALReplayData } from '../types/types';
4
import { StartingContent } from './withStartingIndicator';
5
import { Alert, Progress } from 'reactstrap';
6

7
describe('Starting', () => {
8
  describe('progress bar', () => {
9
    it('does not show when replay not started', () => {
10
      const status: WALReplayData = {
11
        min: 0,
12
        max: 0,
13
        current: 0,
14
      };
15
      const starting = shallow(<StartingContent status={status} isUnexpected={false} />);
16
      const progress = starting.find(Progress);
17
      expect(progress).toHaveLength(0);
18
    });
19

20
    it('shows progress bar when max is not 0', () => {
21
      const status: WALReplayData = {
22
        min: 0,
23
        max: 1,
24
        current: 0,
25
      };
26
      const starting = shallow(<StartingContent status={status} isUnexpected={false} />);
27
      const progress = starting.find(Progress);
28
      expect(progress).toHaveLength(1);
29
    });
30

31
    it('renders progress correctly', () => {
32
      const status: WALReplayData = {
33
        min: 0,
34
        max: 20,
35
        current: 1,
36
      };
37
      const starting = shallow(<StartingContent status={status} isUnexpected={false} />);
38
      const progress = starting.find(Progress);
39
      expect(progress.prop('value')).toBe(2);
40
      expect(progress.prop('min')).toBe(0);
41
      expect(progress.prop('max')).toBe(21);
42
    });
43

44
    it('shows done when replay done', () => {
45
      const status: WALReplayData = {
46
        min: 0,
47
        max: 20,
48
        current: 20,
49
      };
50
      const starting = shallow(<StartingContent status={status} isUnexpected={false} />);
51
      const progress = starting.find(Progress);
52
      expect(progress.prop('value')).toBe(21);
53
      expect(progress.prop('color')).toBe('success');
54
    });
55

56
    it('shows unexpected error', () => {
57
      const status: WALReplayData = {
58
        min: 0,
59
        max: 20,
60
        current: 0,
61
      };
62

63
      const starting = shallow(<StartingContent status={status} isUnexpected={true} />);
64
      const alert = starting.find(Alert);
65
      expect(alert.prop('color')).toBe('danger');
66
    });
67
  });
68
});
69

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.