Merge pull request #130 from SamR1/fix-sports-dropdown-on-edition
display only active sports on workout edition
This commit is contained in:
		
							
								
								
									
										2
									
								
								fittrackee/dist/index.html
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								fittrackee/dist/index.html
									
									
									
									
										vendored
									
									
								
							@@ -1 +1 @@
 | 
			
		||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.e77f8b26.css" rel="prefetch"><link href="/static/css/profile.8b668068.css" rel="prefetch"><link href="/static/css/reset.fc19709e.css" rel="prefetch"><link href="/static/css/statistics.2afdc8a9.css" rel="prefetch"><link href="/static/css/workouts.5ffd5cc1.css" rel="prefetch"><link href="/static/js/admin.5f46d0fe.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/profile.d25975e2.js" rel="prefetch"><link href="/static/js/reset.ca898ebe.js" rel="prefetch"><link href="/static/js/statistics.d03ca304.js" rel="prefetch"><link href="/static/js/workouts.e3d575e0.js" rel="prefetch"><link href="/static/css/app.d45a3498.css" rel="preload" as="style"><link href="/static/js/app.82615f01.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.96f7cd19.js" rel="preload" as="script"><link href="/static/css/app.d45a3498.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.96f7cd19.js"></script><script src="/static/js/app.82615f01.js"></script></body></html>
 | 
			
		||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.e77f8b26.css" rel="prefetch"><link href="/static/css/profile.8b668068.css" rel="prefetch"><link href="/static/css/reset.fc19709e.css" rel="prefetch"><link href="/static/css/statistics.2afdc8a9.css" rel="prefetch"><link href="/static/css/workouts.45a25b09.css" rel="prefetch"><link href="/static/js/admin.5f46d0fe.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/profile.d25975e2.js" rel="prefetch"><link href="/static/js/reset.ca898ebe.js" rel="prefetch"><link href="/static/js/statistics.d03ca304.js" rel="prefetch"><link href="/static/js/workouts.29d99435.js" rel="prefetch"><link href="/static/css/app.b54fa5fe.css" rel="preload" as="style"><link href="/static/js/app.20ff75b6.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.96f7cd19.js" rel="preload" as="script"><link href="/static/css/app.b54fa5fe.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.96f7cd19.js"></script><script src="/static/js/app.20ff75b6.js"></script></body></html>
 | 
			
		||||
@@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
 | 
			
		||||
    "url": "/img/workouts/mountains.svg"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "b7b3db3d91da8b9f56e6884323729083",
 | 
			
		||||
    "revision": "01fa6f51e99303e6aa0af8c057385a81",
 | 
			
		||||
    "url": "/index.html"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@@ -80,8 +80,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
 | 
			
		||||
    "url": "/static/css/admin.e77f8b26.css"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "1bd90ea525b6b37d9aaa",
 | 
			
		||||
    "url": "/static/css/app.d45a3498.css"
 | 
			
		||||
    "revision": "0a338b320a8168eedc37",
 | 
			
		||||
    "url": "/static/css/app.b54fa5fe.css"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "82c1118c918377daaa71a320ab8eea42",
 | 
			
		||||
@@ -104,8 +104,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
 | 
			
		||||
    "url": "/static/css/statistics.2afdc8a9.css"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "839b1979e05d0b296f23",
 | 
			
		||||
    "url": "/static/css/workouts.5ffd5cc1.css"
 | 
			
		||||
    "revision": "c180861cd9daea671c18",
 | 
			
		||||
    "url": "/static/css/workouts.45a25b09.css"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "e719f9244c69e28e7d00e725ca1e280e",
 | 
			
		||||
@@ -192,8 +192,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
 | 
			
		||||
    "url": "/static/js/admin.5f46d0fe.js"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "1bd90ea525b6b37d9aaa",
 | 
			
		||||
    "url": "/static/js/app.82615f01.js"
 | 
			
		||||
    "revision": "0a338b320a8168eedc37",
 | 
			
		||||
    "url": "/static/js/app.20ff75b6.js"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "bd7d183c9f68e5f4027d",
 | 
			
		||||
@@ -232,7 +232,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
 | 
			
		||||
    "url": "/static/js/statistics.d03ca304.js"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "revision": "839b1979e05d0b296f23",
 | 
			
		||||
    "url": "/static/js/workouts.e3d575e0.js"
 | 
			
		||||
    "revision": "c180861cd9daea671c18",
 | 
			
		||||
    "url": "/static/js/workouts.29d99435.js"
 | 
			
		||||
  }
 | 
			
		||||
]);
 | 
			
		||||
							
								
								
									
										2
									
								
								fittrackee/dist/service-worker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								fittrackee/dist/service-worker.js
									
									
									
									
										vendored
									
									
								
							@@ -14,7 +14,7 @@
 | 
			
		||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
 | 
			
		||||
 | 
			
		||||
importScripts(
 | 
			
		||||
  "/precache-manifest.72ed3f6c1b2aa3b8130086e25c17c6c0.js"
 | 
			
		||||
  "/precache-manifest.0aa7df09e6fa099292b07eaf79ffeac5.js"
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								fittrackee/dist/static/js/app.20ff75b6.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								fittrackee/dist/static/js/app.20ff75b6.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								fittrackee/dist/static/js/app.20ff75b6.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								fittrackee/dist/static/js/app.20ff75b6.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								fittrackee/dist/static/js/app.82615f01.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								fittrackee/dist/static/js/app.82615f01.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								fittrackee/dist/static/js/workouts.29d99435.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								fittrackee/dist/static/js/workouts.29d99435.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -189,7 +189,7 @@
 | 
			
		||||
    () => store.getters[SPORTS_STORE.GETTERS.SPORTS]
 | 
			
		||||
  )
 | 
			
		||||
  const translatedSports: ComputedRef<ITranslatedSport[]> = computed(() =>
 | 
			
		||||
    translateSports(sports.value, t, true, user.value.sports_list)
 | 
			
		||||
    translateSports(sports.value, t, 'is_active', user.value.sports_list)
 | 
			
		||||
  )
 | 
			
		||||
  const loading = computed(
 | 
			
		||||
    () => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING]
 | 
			
		||||
 
 | 
			
		||||
@@ -267,8 +267,8 @@
 | 
			
		||||
    translateSports(
 | 
			
		||||
      props.sports,
 | 
			
		||||
      t,
 | 
			
		||||
      true,
 | 
			
		||||
      workout.value.id ? [workout.value.sport_id] : null
 | 
			
		||||
      'is_active_for_user',
 | 
			
		||||
      workout.value.id ? [workout.value.sport_id] : []
 | 
			
		||||
    )
 | 
			
		||||
  )
 | 
			
		||||
  const appConfig: ComputedRef<TAppConfig> = computed(
 | 
			
		||||
 
 | 
			
		||||
@@ -17,3 +17,5 @@ export interface ISportPayload {
 | 
			
		||||
  id: number
 | 
			
		||||
  isActive: boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TActiveStatus = 'is_active' | 'is_active_for_user' | 'all'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { ISport, ITranslatedSport } from '@/types/sports'
 | 
			
		||||
import { ISport, ITranslatedSport, TActiveStatus } from '@/types/sports'
 | 
			
		||||
import { IWorkout } from '@/types/workouts'
 | 
			
		||||
 | 
			
		||||
// TODO: allow user to change colors
 | 
			
		||||
@@ -39,16 +39,14 @@ const sortSports = (a: ITranslatedSport, b: ITranslatedSport): number => {
 | 
			
		||||
export const translateSports = (
 | 
			
		||||
  sports: ISport[],
 | 
			
		||||
  t: CallableFunction,
 | 
			
		||||
  onlyActive = false,
 | 
			
		||||
  userSports: number[] | null = null
 | 
			
		||||
  activeStatus: TActiveStatus = 'all',
 | 
			
		||||
  sportsToInclude: number[] = []
 | 
			
		||||
): ITranslatedSport[] =>
 | 
			
		||||
  sports
 | 
			
		||||
    .filter((sport) =>
 | 
			
		||||
      onlyActive
 | 
			
		||||
        ? userSports === null
 | 
			
		||||
          ? sport.is_active_for_user
 | 
			
		||||
          : userSports.includes(sport.id) || sport.is_active
 | 
			
		||||
        : true
 | 
			
		||||
      activeStatus === 'all'
 | 
			
		||||
        ? true
 | 
			
		||||
        : sportsToInclude.includes(sport.id) || sport[activeStatus]
 | 
			
		||||
    )
 | 
			
		||||
    .map((sport) => ({
 | 
			
		||||
      ...sport,
 | 
			
		||||
 
 | 
			
		||||
@@ -3,19 +3,33 @@ import { assert } from 'chai'
 | 
			
		||||
import { sports } from './fixtures'
 | 
			
		||||
 | 
			
		||||
import createI18n from '@/i18n'
 | 
			
		||||
import { ISport, TActiveStatus } from '@/types/sports'
 | 
			
		||||
import { translateSports } from '@/utils/sports'
 | 
			
		||||
 | 
			
		||||
const { t, locale } = createI18n.global
 | 
			
		||||
 | 
			
		||||
interface IInputParam {
 | 
			
		||||
  sports: ISport[]
 | 
			
		||||
  locale: string
 | 
			
		||||
  activeStatus: TActiveStatus
 | 
			
		||||
  sportsToInclude: number[]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ITestParameter {
 | 
			
		||||
  description: string
 | 
			
		||||
  inputParams: IInputParam
 | 
			
		||||
  expected: Record<never, never>[]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('translateSports', () => {
 | 
			
		||||
  const testsParams = [
 | 
			
		||||
  const testsParams: ITestParameter[] = [
 | 
			
		||||
    {
 | 
			
		||||
      description: "returns sorted all translated sports (with 'en' locale)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -55,12 +69,46 @@ describe('translateSports', () => {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description:
 | 
			
		||||
        "returns sorted only translated sports, active for user (with 'en' locales)",
 | 
			
		||||
        "returns sorted only active translated sports (with 'en' locales)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: true,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'is_active',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
          color: null,
 | 
			
		||||
          has_workouts: false,
 | 
			
		||||
          id: 1,
 | 
			
		||||
          img: '/img/sports/cycling-sport.png',
 | 
			
		||||
          is_active: true,
 | 
			
		||||
          is_active_for_user: true,
 | 
			
		||||
          label: 'Cycling (Sport)',
 | 
			
		||||
          stopped_speed_threshold: 1,
 | 
			
		||||
          translatedLabel: 'Cycling (Sport)',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          color: null,
 | 
			
		||||
          has_workouts: true,
 | 
			
		||||
          id: 3,
 | 
			
		||||
          img: '/img/sports/hiking.png',
 | 
			
		||||
          is_active: true,
 | 
			
		||||
          is_active_for_user: false,
 | 
			
		||||
          label: 'Hiking',
 | 
			
		||||
          stopped_speed_threshold: 0.1,
 | 
			
		||||
          translatedLabel: 'Hiking',
 | 
			
		||||
        },
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description:
 | 
			
		||||
        "returns sorted translated sports active for user (with 'en' locales)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        activeStatus: 'is_active_for_user',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -77,12 +125,12 @@ describe('translateSports', () => {
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description: "returns empty array (with 'en' locale)",
 | 
			
		||||
      description: "returns empty array if not sports (with 'en' locale)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports: [],
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [],
 | 
			
		||||
    },
 | 
			
		||||
@@ -91,8 +139,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: [],
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -132,12 +180,46 @@ describe('translateSports', () => {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description:
 | 
			
		||||
        "returns sorted only translated sports, active for user (with 'fr' locales)",
 | 
			
		||||
        "returns sorted only active translated sports (with 'fr' locales)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: true,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'is_active',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
          color: null,
 | 
			
		||||
          has_workouts: true,
 | 
			
		||||
          id: 3,
 | 
			
		||||
          img: '/img/sports/hiking.png',
 | 
			
		||||
          is_active: true,
 | 
			
		||||
          is_active_for_user: false,
 | 
			
		||||
          label: 'Hiking',
 | 
			
		||||
          stopped_speed_threshold: 0.1,
 | 
			
		||||
          translatedLabel: 'Randonnée',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          color: null,
 | 
			
		||||
          has_workouts: false,
 | 
			
		||||
          id: 1,
 | 
			
		||||
          img: '/img/sports/cycling-sport.png',
 | 
			
		||||
          is_active: true,
 | 
			
		||||
          is_active_for_user: true,
 | 
			
		||||
          label: 'Cycling (Sport)',
 | 
			
		||||
          stopped_speed_threshold: 1,
 | 
			
		||||
          translatedLabel: 'Vélo (Sport)',
 | 
			
		||||
        },
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description:
 | 
			
		||||
        "returns sorted translated sports, active for user (with 'fr' locales)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        activeStatus: 'is_active_for_user',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -154,12 +236,12 @@ describe('translateSports', () => {
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      description: "returns empty array (with 'fr' locale)",
 | 
			
		||||
      description: "returns empty array if not sports (with 'fr' locale)",
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports: [],
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [],
 | 
			
		||||
    },
 | 
			
		||||
@@ -169,8 +251,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: [2],
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -214,8 +296,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: true,
 | 
			
		||||
        userSports: [2],
 | 
			
		||||
        activeStatus: 'is_active',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -259,8 +341,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports: [],
 | 
			
		||||
        locale: 'en',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: null,
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [],
 | 
			
		||||
    },
 | 
			
		||||
@@ -270,8 +352,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: [2],
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -315,8 +397,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports,
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: true,
 | 
			
		||||
        userSports: [2],
 | 
			
		||||
        activeStatus: 'is_active',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [
 | 
			
		||||
        {
 | 
			
		||||
@@ -360,8 +442,8 @@ describe('translateSports', () => {
 | 
			
		||||
      inputParams: {
 | 
			
		||||
        sports: [],
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        onlyActive: false,
 | 
			
		||||
        userSports: [2],
 | 
			
		||||
        activeStatus: 'all',
 | 
			
		||||
        sportsToInclude: [2],
 | 
			
		||||
      },
 | 
			
		||||
      expected: [],
 | 
			
		||||
    },
 | 
			
		||||
@@ -373,8 +455,8 @@ describe('translateSports', () => {
 | 
			
		||||
        translateSports(
 | 
			
		||||
          testParams.inputParams.sports,
 | 
			
		||||
          t,
 | 
			
		||||
          testParams.inputParams.onlyActive,
 | 
			
		||||
          testParams.inputParams.userSports
 | 
			
		||||
          testParams.inputParams.activeStatus,
 | 
			
		||||
          testParams.inputParams.sportsToInclude
 | 
			
		||||
        ),
 | 
			
		||||
        testParams.expected
 | 
			
		||||
      )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user