@saooti/octopus-sdk 42.0.0-beta → 42.0.0-beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/src/stores/FilterStore.d.ts +48 -36
  2. package/dist/src/stores/class/rubrique/rubrique.d.ts +10 -3
  3. package/eslint-config.d.ts +3 -0
  4. package/eslint-config.mjs +54 -0
  5. package/package.json +8 -3
  6. package/public/css/fonts/localFonts/Comfortaa-Regular.ttf +0 -0
  7. package/public/css/fonts/localFonts/Comfortaa-Regular.woff2 +0 -0
  8. package/public/css/fonts/localFonts/Cookie-Regular.ttf +0 -0
  9. package/public/css/fonts/localFonts/Cookie-Regular.woff2 +0 -0
  10. package/public/css/fonts/localFonts/Montserrat-Black.ttf +0 -0
  11. package/public/css/fonts/localFonts/Montserrat-Black.woff2 +0 -0
  12. package/public/css/fonts/localFonts/Montserrat-BlackItalic.ttf +0 -0
  13. package/public/css/fonts/localFonts/Montserrat-BlackItalic.woff2 +0 -0
  14. package/public/css/fonts/localFonts/Montserrat-Bold.ttf +0 -0
  15. package/public/css/fonts/localFonts/Montserrat-Bold.woff2 +0 -0
  16. package/public/css/fonts/localFonts/Montserrat-BoldItalic.ttf +0 -0
  17. package/public/css/fonts/localFonts/Montserrat-BoldItalic.woff2 +0 -0
  18. package/public/css/fonts/localFonts/Montserrat-ExtraBold.ttf +0 -0
  19. package/public/css/fonts/localFonts/Montserrat-ExtraBold.woff2 +0 -0
  20. package/public/css/fonts/localFonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  21. package/public/css/fonts/localFonts/Montserrat-ExtraBoldItalic.woff2 +0 -0
  22. package/public/css/fonts/localFonts/Montserrat-ExtraLight.ttf +0 -0
  23. package/public/css/fonts/localFonts/Montserrat-ExtraLight.woff2 +0 -0
  24. package/public/css/fonts/localFonts/Montserrat-ExtraLightItalic.ttf +0 -0
  25. package/public/css/fonts/localFonts/Montserrat-ExtraLightItalic.woff2 +0 -0
  26. package/public/css/fonts/localFonts/Montserrat-Italic.ttf +0 -0
  27. package/public/css/fonts/localFonts/Montserrat-Italic.woff2 +0 -0
  28. package/public/css/fonts/localFonts/Montserrat-Light.ttf +0 -0
  29. package/public/css/fonts/localFonts/Montserrat-Light.woff2 +0 -0
  30. package/public/css/fonts/localFonts/Montserrat-LightItalic.ttf +0 -0
  31. package/public/css/fonts/localFonts/Montserrat-LightItalic.woff2 +0 -0
  32. package/public/css/fonts/localFonts/Montserrat-Medium.ttf +0 -0
  33. package/public/css/fonts/localFonts/Montserrat-Medium.woff2 +0 -0
  34. package/public/css/fonts/localFonts/Montserrat-MediumItalic.ttf +0 -0
  35. package/public/css/fonts/localFonts/Montserrat-MediumItalic.woff2 +0 -0
  36. package/public/css/fonts/localFonts/Montserrat-Regular.ttf +0 -0
  37. package/public/css/fonts/localFonts/Montserrat-Regular.woff2 +0 -0
  38. package/public/css/fonts/localFonts/Montserrat-SemiBold.ttf +0 -0
  39. package/public/css/fonts/localFonts/Montserrat-SemiBold.woff2 +0 -0
  40. package/public/css/fonts/localFonts/Montserrat-SemiBoldItalic.ttf +0 -0
  41. package/public/css/fonts/localFonts/Montserrat-SemiBoldItalic.woff2 +0 -0
  42. package/public/css/fonts/localFonts/Montserrat-Thin.ttf +0 -0
  43. package/public/css/fonts/localFonts/Montserrat-Thin.woff2 +0 -0
  44. package/public/css/fonts/localFonts/Montserrat-ThinItalic.ttf +0 -0
  45. package/public/css/fonts/localFonts/Montserrat-ThinItalic.woff2 +0 -0
  46. package/public/css/fonts/localFonts/Roboto-Regular.ttf +0 -0
  47. package/public/css/fonts/localFonts/Roboto-Regular.woff2 +0 -0
  48. package/public/css/fonts/localFonts/RobotoSlab-Regular.ttf +0 -0
  49. package/public/css/fonts/localFonts/RobotoSlab-Regular.woff2 +0 -0
  50. package/public/css/fonts/localFonts/style.css +72 -0
  51. package/tests/api/podcastApi.spec.ts +43 -0
  52. package/tests/api/transcriptionApi.spec.ts +58 -0
  53. package/tests/components/composable/player/usePlayerTranscript.spec.ts +238 -0
  54. package/tests/components/composable/useAdvancedParamInit.spec.ts +91 -0
  55. package/tests/components/composable/usePresentationItem.spec.ts +164 -0
  56. package/tests/components/composable/useRights.spec.ts +838 -0
  57. package/tests/components/composable/useSeasonsManagement.spec.ts +35 -0
  58. package/tests/components/composable/useTranslation.spec.ts +209 -0
  59. package/tests/components/display/RightsIndicator.spec.ts +481 -0
  60. package/tests/components/display/comments/item/CommentMoreActions.spec.ts +75 -0
  61. package/tests/components/display/comments/modal/RecaptchaModal.spec.ts +43 -0
  62. package/tests/components/display/emission/EmissionItem.spec.ts +54 -0
  63. package/tests/components/display/emission/EmissionPresentationItem.spec.ts +46 -0
  64. package/tests/components/display/filter/AdvancedSearch.spec.ts +187 -0
  65. package/tests/components/display/podcasts/PodcastFilterList.spec.ts +34 -0
  66. package/tests/components/display/podcasts/PodcastInlineListTemplate.spec.ts +24 -0
  67. package/tests/components/display/podcasts/PodcastItemInfo.spec.ts +99 -0
  68. package/tests/components/display/podcasts/PodcastModuleBox.spec.ts +279 -0
  69. package/tests/components/display/podcasts/PodcastPresentationList.spec.ts +108 -0
  70. package/tests/components/display/podcasts/PodcastRawTranscript.spec.ts +254 -0
  71. package/tests/components/display/sharing/ShareNewsletter.spec.ts +68 -0
  72. package/tests/components/display/sharing/SharePlayer.spec.ts +59 -0
  73. package/tests/components/display/sharing/SharePlayerRadio.spec.ts +55 -0
  74. package/tests/components/form/ClassicButtonGroup.spec.ts +78 -0
  75. package/tests/components/form/ClassicInputText.spec.ts +24 -0
  76. package/tests/components/form/OctopusMultiselect.spec.ts +506 -0
  77. package/tests/components/form/OctopusSelect.spec.ts +240 -0
  78. package/tests/components/layouts/PresentationItem.spec.ts +37 -0
  79. package/tests/components/misc/ClassicAvatar.spec.ts +68 -0
  80. package/tests/components/misc/ClassicPopover.spec.ts +260 -0
  81. package/tests/components/misc/FooterSection.spec.ts +49 -0
  82. package/tests/components/misc/HomeDropdown.spec.ts +44 -0
  83. package/tests/components/misc/modal/ClipboardModal.spec.ts +51 -0
  84. package/tests/components/misc/player/PlayerLarge.spec.ts +72 -0
  85. package/tests/components/pages/EmissionPage.spec.ts +253 -0
  86. package/tests/components/pages/EmissionsPage.spec.ts +18 -0
  87. package/tests/components/pages/ParticipantPage.spec.ts +65 -0
  88. package/tests/components/pages/PlaylistPage.spec.ts +60 -0
  89. package/tests/components/pages/PodcastPage.spec.ts +89 -0
  90. package/tests/components/pages/PodcastsPage.spec.ts +18 -0
  91. package/tests/components/pages/RadioPage.spec.ts +65 -0
  92. package/tests/components/pages/SmartLinkPage.spec.ts +90 -0
  93. package/tests/helper/language.spec.ts +45 -0
  94. package/tests/index.ts +9 -0
  95. package/tests/localisation.ts +10 -0
  96. package/tests/mocks/i18n.ts +13 -0
  97. package/tests/mocks/index.ts +11 -0
  98. package/tests/mocks/rights.ts +17 -0
  99. package/tests/mocks/useAdvancedParamInit.ts +22 -0
  100. package/tests/mocks/useRouter.ts +11 -0
  101. package/tests/stores/CacheStore.spec.ts +110 -0
  102. package/tests/utils.ts +178 -0
@@ -26,11 +26,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
26
26
  organisationId?: string;
27
27
  rubriquageId?: number;
28
28
  rubriques: {
29
- emissionCount?: number;
30
29
  name: string;
31
- podcastCount?: number;
32
- rubriquageId?: number;
33
30
  rubriqueId: number;
31
+ rubriquageId?: number;
32
+ emissionCount?: number;
33
+ podcastCount?: number;
34
+ annotations?: Record<string, string | number | boolean>;
34
35
  score?: number;
35
36
  organisationPrivacy?: string;
36
37
  }[];
@@ -42,11 +43,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
42
43
  organisationId?: string;
43
44
  rubriquageId?: number;
44
45
  rubriques: {
45
- emissionCount?: number;
46
46
  name: string;
47
- podcastCount?: number;
48
- rubriquageId?: number;
49
47
  rubriqueId: number;
48
+ rubriquageId?: number;
49
+ emissionCount?: number;
50
+ podcastCount?: number;
51
+ annotations?: Record<string, string | number | boolean>;
50
52
  score?: number;
51
53
  organisationPrivacy?: string;
52
54
  }[];
@@ -67,19 +69,21 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
67
69
  nameRubrique: string;
68
70
  }[]>;
69
71
  filterRubriqueDisplay: import('../../node_modules/vue').Ref<{
70
- emissionCount?: number;
71
72
  name: string;
72
- podcastCount?: number;
73
- rubriquageId?: number;
74
73
  rubriqueId: number;
74
+ rubriquageId?: number;
75
+ emissionCount?: number;
76
+ podcastCount?: number;
77
+ annotations?: Record<string, string | number | boolean>;
75
78
  score?: number;
76
79
  organisationPrivacy?: string;
77
80
  }[], Rubrique[] | {
78
- emissionCount?: number;
79
81
  name: string;
80
- podcastCount?: number;
81
- rubriquageId?: number;
82
82
  rubriqueId: number;
83
+ rubriquageId?: number;
84
+ emissionCount?: number;
85
+ podcastCount?: number;
86
+ annotations?: Record<string, string | number | boolean>;
83
87
  score?: number;
84
88
  organisationPrivacy?: string;
85
89
  }[]>;
@@ -105,11 +109,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
105
109
  organisationId?: string;
106
110
  rubriquageId?: number;
107
111
  rubriques: {
108
- emissionCount?: number;
109
112
  name: string;
110
- podcastCount?: number;
111
- rubriquageId?: number;
112
113
  rubriqueId: number;
114
+ rubriquageId?: number;
115
+ emissionCount?: number;
116
+ podcastCount?: number;
117
+ annotations?: Record<string, string | number | boolean>;
113
118
  score?: number;
114
119
  organisationPrivacy?: string;
115
120
  }[];
@@ -121,11 +126,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
121
126
  organisationId?: string;
122
127
  rubriquageId?: number;
123
128
  rubriques: {
124
- emissionCount?: number;
125
129
  name: string;
126
- podcastCount?: number;
127
- rubriquageId?: number;
128
130
  rubriqueId: number;
131
+ rubriquageId?: number;
132
+ emissionCount?: number;
133
+ podcastCount?: number;
134
+ annotations?: Record<string, string | number | boolean>;
129
135
  score?: number;
130
136
  organisationPrivacy?: string;
131
137
  }[];
@@ -146,19 +152,21 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
146
152
  nameRubrique: string;
147
153
  }[]>;
148
154
  filterRubriqueDisplay: import('../../node_modules/vue').Ref<{
149
- emissionCount?: number;
150
155
  name: string;
151
- podcastCount?: number;
152
- rubriquageId?: number;
153
156
  rubriqueId: number;
157
+ rubriquageId?: number;
158
+ emissionCount?: number;
159
+ podcastCount?: number;
160
+ annotations?: Record<string, string | number | boolean>;
154
161
  score?: number;
155
162
  organisationPrivacy?: string;
156
163
  }[], Rubrique[] | {
157
- emissionCount?: number;
158
164
  name: string;
159
- podcastCount?: number;
160
- rubriquageId?: number;
161
165
  rubriqueId: number;
166
+ rubriquageId?: number;
167
+ emissionCount?: number;
168
+ podcastCount?: number;
169
+ annotations?: Record<string, string | number | boolean>;
162
170
  score?: number;
163
171
  organisationPrivacy?: string;
164
172
  }[]>;
@@ -184,11 +192,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
184
192
  organisationId?: string;
185
193
  rubriquageId?: number;
186
194
  rubriques: {
187
- emissionCount?: number;
188
195
  name: string;
189
- podcastCount?: number;
190
- rubriquageId?: number;
191
196
  rubriqueId: number;
197
+ rubriquageId?: number;
198
+ emissionCount?: number;
199
+ podcastCount?: number;
200
+ annotations?: Record<string, string | number | boolean>;
192
201
  score?: number;
193
202
  organisationPrivacy?: string;
194
203
  }[];
@@ -200,11 +209,12 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
200
209
  organisationId?: string;
201
210
  rubriquageId?: number;
202
211
  rubriques: {
203
- emissionCount?: number;
204
212
  name: string;
205
- podcastCount?: number;
206
- rubriquageId?: number;
207
213
  rubriqueId: number;
214
+ rubriquageId?: number;
215
+ emissionCount?: number;
216
+ podcastCount?: number;
217
+ annotations?: Record<string, string | number | boolean>;
208
218
  score?: number;
209
219
  organisationPrivacy?: string;
210
220
  }[];
@@ -225,19 +235,21 @@ export declare const useFilterStore: import('pinia').StoreDefinition<"FilterStor
225
235
  nameRubrique: string;
226
236
  }[]>;
227
237
  filterRubriqueDisplay: import('../../node_modules/vue').Ref<{
228
- emissionCount?: number;
229
238
  name: string;
230
- podcastCount?: number;
231
- rubriquageId?: number;
232
239
  rubriqueId: number;
240
+ rubriquageId?: number;
241
+ emissionCount?: number;
242
+ podcastCount?: number;
243
+ annotations?: Record<string, string | number | boolean>;
233
244
  score?: number;
234
245
  organisationPrivacy?: string;
235
246
  }[], Rubrique[] | {
236
- emissionCount?: number;
237
247
  name: string;
238
- podcastCount?: number;
239
- rubriquageId?: number;
240
248
  rubriqueId: number;
249
+ rubriquageId?: number;
250
+ emissionCount?: number;
251
+ podcastCount?: number;
252
+ annotations?: Record<string, string | number | boolean>;
241
253
  score?: number;
242
254
  organisationPrivacy?: string;
243
255
  }[]>;
@@ -1,9 +1,16 @@
1
1
  export interface Rubrique {
2
- emissionCount?: number;
2
+ /** Name of the rubrique */
3
3
  name: string;
4
- podcastCount?: number;
5
- rubriquageId?: number;
4
+ /** ID of the rubrique */
6
5
  rubriqueId: number;
6
+ /** ID of the rubriquage this rubrique belongs to */
7
+ rubriquageId?: number;
8
+ /** Number of emissions in the rubrique */
9
+ emissionCount?: number;
10
+ /** Number of podcasts in the rubrique */
11
+ podcastCount?: number;
12
+ /** Custom properties defined on the rubrique */
13
+ annotations?: Record<string, string | number | boolean>;
7
14
  score?: number;
8
15
  organisationPrivacy?: string;
9
16
  }
@@ -0,0 +1,3 @@
1
+ import type { ConfigArray } from 'typescript-eslint';
2
+ declare const config: ConfigArray;
3
+ export default config;
@@ -0,0 +1,54 @@
1
+ import eslint from '@eslint/js';
2
+ import eslintPluginVue from 'eslint-plugin-vue';
3
+ import globals from 'globals';
4
+ import typescriptEslint from 'typescript-eslint';
5
+ import stylistic from '@stylistic/eslint-plugin';
6
+
7
+ export default typescriptEslint.config(
8
+ { ignores: ['*.d.ts', '**/coverage', '**/dist'] },
9
+ {
10
+ extends: [
11
+ eslint.configs.recommended,
12
+ ...typescriptEslint.configs.recommended,
13
+ ...eslintPluginVue.configs['flat/recommended'],
14
+ ],
15
+ plugins: {
16
+ '@stylistic': stylistic,
17
+ },
18
+ files: ['**/*.{ts,vue}'],
19
+ languageOptions: {
20
+ ecmaVersion: 'latest',
21
+ sourceType: 'module',
22
+ globals: globals.browser,
23
+ parserOptions: {
24
+ parser: typescriptEslint.parser,
25
+ },
26
+ },
27
+ rules: {
28
+ // your rules
29
+ "curly": ['error'],
30
+
31
+ // Please don't use console statements and duplicated imports, TODOs are marked
32
+ "no-console": ['warn', { allow: ['warn', 'error'] }],
33
+ "no-warning-comments": ['warn'],
34
+ "no-duplicate-imports": ['warn'],
35
+
36
+ // Prevent errors when testing on refs (instead of value of ref)
37
+ "vue/no-ref-as-operand": ['error'],
38
+
39
+ // Indentation
40
+ "@stylistic/indent": ['warn', 4, { "SwitchCase": 0 }],
41
+ "vue/html-indent": ['warn', 4],
42
+ "vue/script-indent": ['warn', 4],
43
+ "@stylistic/no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
44
+
45
+ // Number of attributes per line (increase because sometimes two is not a lot)
46
+ "vue/max-attributes-per-line": ['warn', { singleline: 2 } ],
47
+
48
+ // Disable default values required for props
49
+ "vue/require-default-prop": ['off'],
50
+
51
+ "@typescript-eslint/no-unused-vars": "warn"
52
+ }
53
+ }
54
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "42.0.0-beta",
3
+ "version": "42.0.0-beta3",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -119,10 +119,15 @@
119
119
  "./eslint-config": {
120
120
  "types": "./eslint-config.d.ts",
121
121
  "default": "./eslint-config.mjs"
122
- }
122
+ },
123
+ "./fonts/style.css": "./public/css/fonts/localFonts/style.css"
123
124
  },
124
125
  "files": [
125
126
  "dist",
126
- "src"
127
+ "src",
128
+ "tests",
129
+ "eslint-config.mjs",
130
+ "eslint-config.d.ts",
131
+ "public/css/fonts/localFonts"
127
132
  ]
128
133
  }
@@ -0,0 +1,72 @@
1
+ @font-face {
2
+ font-family: "Montserrat";
3
+ src: local("Montserrat"),
4
+ url("./Montserrat-Regular.woff2") format('woff2'),
5
+ url("./Montserrat-Regular.ttf") format("truetype");
6
+ font-weight: 400;
7
+ font-style: normal;
8
+ font-display: swap;
9
+ }
10
+ @font-face {
11
+ font-family: "Montserrat";
12
+ src: local("Montserrat"),
13
+ url("./Montserrat-Medium.woff2") format('woff2'),
14
+ url("./Montserrat-Medium.ttf") format("truetype");
15
+ font-weight: 500;
16
+ font-style: normal;
17
+ font-display: swap;
18
+ }
19
+ @font-face {
20
+ font-family: "Montserrat";
21
+ src: local("Montserrat"),
22
+ url("./Montserrat-SemiBold.woff2") format('woff2'),
23
+ url("./Montserrat-SemiBold.ttf") format("truetype");
24
+ font-weight: 600;
25
+ font-style: normal;
26
+ font-display: swap;
27
+ }
28
+ @font-face {
29
+ font-family: "Montserrat";
30
+ src: local("Montserrat"),
31
+ url("./Montserrat-Bold.woff2") format('woff2'),
32
+ url("./Montserrat-Bold.ttf") format("truetype");
33
+ font-weight: 700;
34
+ font-style: normal;
35
+ font-display: swap;
36
+ }
37
+ @font-face {
38
+ font-family: "Cookie";
39
+ src: local("Cookie"),
40
+ url("./Cookie-Regular.woff2") format('woff2'),
41
+ url("./Cookie-Regular.ttf") format("truetype");
42
+ font-weight: 400;
43
+ font-style: normal;
44
+ font-display: swap;
45
+ }
46
+ @font-face {
47
+ font-family: "Comfortaa";
48
+ src: local("Comfortaa"),
49
+ url("./Comfortaa-Regular.woff2") format('woff2'),
50
+ url("./Comfortaa-Regular.ttf") format("truetype");
51
+ font-weight: 400;
52
+ font-style: normal;
53
+ font-display: swap;
54
+ }
55
+ @font-face {
56
+ font-family: "Roboto";
57
+ src: local("Roboto"),
58
+ url("./Roboto-Regular.woff2") format('woff2'),
59
+ url("./Roboto-Regular.ttf") format("truetype");
60
+ font-weight: 400;
61
+ font-style: normal;
62
+ font-display: swap;
63
+ }
64
+ @font-face {
65
+ font-family: "Roboto Slab";
66
+ src: local("Roboto Slab"),
67
+ url("./RobotoSlab-Regular.woff2") format('woff2'),
68
+ url("./RobotoSlab-Regular.ttf") format("truetype");
69
+ font-weight: 400;
70
+ font-style: normal;
71
+ font-display: swap;
72
+ }
@@ -0,0 +1,43 @@
1
+ import { describe, expect, it, vi, beforeEach } from 'vitest';
2
+
3
+ vi.mock('../../src/api/classicApi', () => ({
4
+ default: {
5
+ fetchData: vi.fn()
6
+ }
7
+ }));
8
+
9
+ import classicApi from '../../src/api/classicApi';
10
+ import { podcastApi } from '../../src/api/podcastApi';
11
+
12
+ const baseOptions = { organisationId: ['org-1'] };
13
+
14
+ describe('podcastApi', () => {
15
+ describe('count', () => {
16
+ beforeEach(() => {
17
+ vi.mocked(classicApi.fetchData).mockResolvedValue({ count: 42, result: [], sort: null });
18
+ });
19
+
20
+ it('returns the count from search results', async () => {
21
+ const result = await podcastApi.count(baseOptions);
22
+ expect(result).toBe(42);
23
+ });
24
+
25
+ it('calls search with size 0', async () => {
26
+ await podcastApi.count(baseOptions);
27
+ expect(classicApi.fetchData).toHaveBeenCalledWith(
28
+ expect.objectContaining({
29
+ parameters: expect.objectContaining({ size: 0 })
30
+ })
31
+ );
32
+ });
33
+
34
+ it('forwards other options to search', async () => {
35
+ await podcastApi.count({ ...baseOptions, emissionId: 5 });
36
+ expect(classicApi.fetchData).toHaveBeenCalledWith(
37
+ expect.objectContaining({
38
+ parameters: expect.objectContaining({ organisationId: ['org-1'], emissionId: 5 })
39
+ })
40
+ );
41
+ });
42
+ });
43
+ });
@@ -0,0 +1,58 @@
1
+ import { describe, expect, it, vi, beforeEach } from 'vitest';
2
+
3
+ vi.mock('../../src/api/classicApi', () => ({
4
+ default: {
5
+ fetchData: vi.fn()
6
+ }
7
+ }));
8
+
9
+ import classicApi from '../../src/api/classicApi';
10
+ import { transcriptionApi } from '../../src/api/transcriptionApi';
11
+ import { ModuleApi } from '../../src/api/apiConnection';
12
+
13
+ describe('transcriptionApi', () => {
14
+ beforeEach(() => {
15
+ vi.mocked(classicApi.fetchData).mockResolvedValue('');
16
+ });
17
+
18
+ describe('getTranslations', () => {
19
+ it('calls the SPEECHTOTEXT api with the correct path', async () => {
20
+ await transcriptionApi.getTranslations(42);
21
+ expect(classicApi.fetchData).toHaveBeenCalledWith({
22
+ api: ModuleApi.SPEECHTOTEXT,
23
+ path: 'transcription/42/languages',
24
+ });
25
+ });
26
+ });
27
+
28
+ describe('getTranslation', () => {
29
+ it('calls the SPEECHTOTEXT api with the correct path', async () => {
30
+ await transcriptionApi.getTranslation(42, 'en');
31
+ expect(classicApi.fetchData).toHaveBeenCalledWith({
32
+ api: ModuleApi.SPEECHTOTEXT,
33
+ path: 'transcription/42/languages/en/srt',
34
+ });
35
+ });
36
+
37
+ it.each([
38
+ [true, 'true'],
39
+ [false, 'false'],
40
+ ])('appends mayCreateIfNotExists=%s to path when mayCreate is %s', async (mayCreate, suffix) => {
41
+ await transcriptionApi.getTranslation(42, 'en', mayCreate);
42
+ expect(classicApi.fetchData).toHaveBeenCalledWith({
43
+ api: ModuleApi.SPEECHTOTEXT,
44
+ path: `transcription/42/languages/en/srt?mayCreateIfNotExists=${suffix}`,
45
+ });
46
+ });
47
+ });
48
+
49
+ describe('getRawTranscription', () => {
50
+ it('calls the SPEECHTOTEXT api with the correct path', async () => {
51
+ await transcriptionApi.getRawTranscription(42);
52
+ expect(classicApi.fetchData).toHaveBeenCalledWith({
53
+ api: ModuleApi.SPEECHTOTEXT,
54
+ path: 'transcription/text/42',
55
+ });
56
+ });
57
+ });
58
+ });