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

getters.js « test_reports « stores « pipelines « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 56f769c00fa22644a7a7709b5b8af4db7dd47623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { addIconStatus, formattedTime } from './utils';

export const getTestSuites = state => {
  const { test_suites: testSuites = [] } = state.testReports;

  return testSuites.map(suite => ({
    ...suite,
    formattedTime: formattedTime(suite.total_time),
  }));
};

export const getSelectedSuite = state =>
  state.testReports?.test_suites?.[state.selectedSuiteIndex] || {};

export const getSuiteTests = state => {
  const { test_cases: testCases = [] } = getSelectedSuite(state);
  const { page, perPage } = state.pageInfo;
  const start = (page - 1) * perPage;

  return testCases.map(addIconStatus).slice(start, start + perPage);
};

export const getSuiteTestCount = state => getSelectedSuite(state)?.test_cases?.length || 0;