All files / src/constants statistics.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113      8x                   8x                       8x           8x                 8x         8x                                                                                                                                      
// Statistics Constants
 
// Statistics Page Text
export const STATISTICS_PAGE = {
  TITLE: 'Statistics',
  LOADING_TEXT: 'Loading statistics...',
  ERROR_TITLE: 'Failed to Load Statistics',
  ERROR_DEFAULT: 'An unexpected error occurred',
  RETRY_BUTTON: 'Try Again',
  REPORT_TITLE: 'My Own Report',
};
 
// Chart Default Properties
export const CHART_DEFAULTS = {
  DATA_KEY: 'value',
  X_AXIS_KEY: 'company',
  HEIGHT: 400,
  SHOW_GRID: true,
  SHOW_TOOLTIP: true,
  SHOW_X_AXIS: true,
  SHOW_Y_AXIS: true,
  CLASS_NAME: 'w-full',
};
 
// Statistics API Constants
export const STATISTICS_API = {
  ENDPOINT: '/statistics',
  ERROR_MESSAGE: 'Failed to load statistics data',
};
 
// React Query Keys
export const QUERY_KEYS = {
  STATISTICS: {
    ALL: ['statistics'],
    LISTS: ['statistics', 'list'],
    AVERAGE_SCORE: ['statistics', 'averageScore'],
  },
};
 
// Average Score Calculation
export const AVERAGE_SCORE = {
  MAX_SCORE_PER_ITEM: 100,
};
 
// Test Data Constants
export const TEST_DATA = {
  MOCK_STATISTICS: [
    {
      company: 'Amazon',
      value: 42,
      averageScore: { current: 85, total: 100 },
    },
    {
      company: 'Google',
      value: 38,
      averageScore: { current: 75, total: 100 },
    },
    {
      company: 'Apple',
      value: 45,
      averageScore: { current: 90, total: 100 },
    },
  ],
  MOCK_API_RESPONSE: [
    {
      id: 1,
      documentId: 'doc1',
      company: 'Amazon',
      value: 42,
      averageScore: { current: 85, total: 100 },
      category: 'E-commerce',
      date: '2024-01-01',
      createdAt: '2024-01-01T00:00:00.000Z',
      updatedAt: '2024-01-01T00:00:00.000Z',
      publishedAt: '2024-01-01T00:00:00.000Z',
      locale: 'en',
    },
    {
      id: 2,
      documentId: 'doc2',
      company: 'Google',
      value: 38,
      averageScore: { current: 75, total: 100 },
      category: 'Technology',
      date: '2024-01-01',
      createdAt: '2024-01-01T00:00:00.000Z',
      updatedAt: '2024-01-01T00:00:00.000Z',
      publishedAt: '2024-01-01T00:00:00.000Z',
      locale: 'en',
    },
    {
      id: 3,
      documentId: 'doc3',
      company: 'Apple',
      value: 45,
      averageScore: { current: 90, total: 100 },
      category: 'Technology',
      date: '2024-01-01',
      createdAt: '2024-01-01T00:00:00.000Z',
      updatedAt: '2024-01-01T00:00:00.000Z',
      publishedAt: '2024-01-01T00:00:00.000Z',
      locale: 'en',
    },
  ],
  TEST_IDS: {
    BAR_CHART: 'bar-chart',
    PAGE_HEADING: 'page-heading',
    SECTION_HEADING: 'section-heading',
    TEXT: 'text',
    STATISTICS_BAR_CHART: 'statistics-bar-chart',
  },
};