Welcome to mirror list, hosted at ThFree Co, Russian Federation.

humanized_text_spec.js « approvals « components « vue_merge_request_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6776c00b29a191dd0a416f652a531f28f9a0818 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { humanizeInvalidApproversRules } from '~/vue_merge_request_widget/components/approvals/humanized_text';

const testRules = [{ name: 'Lorem' }, { name: 'Ipsum' }, { name: 'Dolar' }];

describe('humanizeInvalidApproversRules', () => {
  it('returns text in regards to a single rule', () => {
    const [singleRule] = testRules;
    expect(humanizeInvalidApproversRules([singleRule])).toBe('"Lorem"');
  });

  it('returns empty text when there is no rule', () => {
    expect(humanizeInvalidApproversRules([])).toBe('');
  });

  it('returns text in regards to multiple rules', () => {
    expect(humanizeInvalidApproversRules(testRules)).toBe('"Lorem", "Ipsum" and "Dolar"');
  });
});