itube-specs 0.0.713 → 0.0.715

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 (55) hide show
  1. package/composables/{use-filter-scheme.test.ts → __tests__/use-filter-scheme.test.ts} +1 -1
  2. package/composables/{use-get-pure-route-name.test.ts → __tests__/use-get-pure-route-name.test.ts} +1 -1
  3. package/composables/{use-get-videos-filter-request.test.ts → __tests__/use-get-videos-filter-request.test.ts} +2 -2
  4. package/composables/{use-model-filter-chips.test.ts → __tests__/use-model-filter-chips.test.ts} +1 -1
  5. package/composables/{use-seo-links.test.ts → __tests__/use-seo-links.test.ts} +1 -1
  6. package/composables/{use-slug.test.ts → __tests__/use-slug.test.ts} +1 -1
  7. package/composables/{use-snackbar.test.ts → __tests__/use-snackbar.test.ts} +1 -1
  8. package/composables/{use-units.test.ts → __tests__/use-units.test.ts} +1 -1
  9. package/package.json +1 -1
  10. package/runtime/index.ts +2 -0
  11. package/runtime/utils/{format-date.test.ts → __tests__/format-date.test.ts} +1 -1
  12. package/runtime/utils/{format-number.test.ts → __tests__/format-number.test.ts} +1 -1
  13. package/runtime/utils/{format-time-ago.test.ts → __tests__/format-time-ago.test.ts} +1 -1
  14. package/runtime/utils/{format-time.test.ts → __tests__/format-time.test.ts} +1 -1
  15. package/runtime/utils/{get-duration.test.ts → __tests__/get-duration.test.ts} +1 -1
  16. package/runtime/utils/{get-month.test.ts → __tests__/get-month.test.ts} +1 -1
  17. package/runtime/utils/{get-multiple-query.test.ts → __tests__/get-multiple-query.test.ts} +1 -1
  18. package/runtime/utils/{get-selected-query.test.ts → __tests__/get-selected-query.test.ts} +1 -1
  19. package/runtime/utils/{is-mobile-device.test.ts → __tests__/is-mobile-device.test.ts} +1 -1
  20. package/runtime/utils/{normalize-url.test.ts → __tests__/normalize-url.test.ts} +1 -1
  21. package/runtime/utils/{validate-email.test.ts → __tests__/validate-email.test.ts} +1 -1
  22. package/runtime/utils/{validate-password.test.ts → __tests__/validate-password.test.ts} +1 -1
  23. package/runtime/utils/{validate-phone.test.ts → __tests__/validate-phone.test.ts} +1 -1
  24. package/runtime/utils/{validate-username.test.ts → __tests__/validate-username.test.ts} +1 -1
  25. package/runtime/utils/{video-data-add-model-icon.test.ts → __tests__/video-data-add-model-icon.test.ts} +1 -1
  26. package/runtime/utils/cleaners/{clean-category-card.test.ts → __tests__/clean-category-card.test.ts} +1 -1
  27. package/runtime/utils/cleaners/{clean-category-info.test.ts → __tests__/clean-category-info.test.ts} +1 -1
  28. package/runtime/utils/cleaners/{clean-channel-card.test.ts → __tests__/clean-channel-card.test.ts} +1 -1
  29. package/runtime/utils/cleaners/{clean-channel-info.test.ts → __tests__/clean-channel-info.test.ts} +1 -1
  30. package/runtime/utils/cleaners/{clean-mini-category-card.test.ts → __tests__/clean-mini-category-card.test.ts} +1 -1
  31. package/runtime/utils/cleaners/{clean-model-card.test.ts → __tests__/clean-model-card.test.ts} +1 -1
  32. package/runtime/utils/cleaners/{clean-playlist-card.test.ts → __tests__/clean-playlist-card.test.ts} +1 -1
  33. package/runtime/utils/cleaners/{clean-playlist-data.test.ts → __tests__/clean-playlist-data.test.ts} +1 -1
  34. package/runtime/utils/cleaners/{clean-playlist-video.test.ts → __tests__/clean-playlist-video.test.ts} +1 -1
  35. package/runtime/utils/cleaners/{clean-profile-data.test.ts → __tests__/clean-profile-data.test.ts} +1 -1
  36. package/runtime/utils/cleaners/{clean-user-playlists-card.test.ts → __tests__/clean-user-playlists-card.test.ts} +1 -1
  37. package/runtime/utils/cleaners/{clean-video-card.test.ts → __tests__/clean-video-card.test.ts} +1 -1
  38. package/runtime/utils/cleaners/{clean-video-data.test.ts → __tests__/clean-video-data.test.ts} +1 -1
  39. package/runtime/utils/converters/{convert-categories-to-chips.test.ts → __tests__/convert-categories-to-chips.test.ts} +1 -1
  40. package/runtime/utils/converters/{convert-categories-to-footer.test.ts → __tests__/convert-categories-to-footer.test.ts} +1 -1
  41. package/runtime/utils/converters/__tests__/convert-channel-to-round-card.test.ts +37 -0
  42. package/runtime/utils/converters/{convert-date-to-timestamp.test.ts → __tests__/convert-date-to-timestamp.test.ts} +1 -1
  43. package/runtime/utils/converters/{convert-model-card-to-chips.test.ts → __tests__/convert-model-card-to-chips.test.ts} +1 -1
  44. package/runtime/utils/converters/__tests__/convert-model-to-round-card.test.ts +59 -0
  45. package/runtime/utils/converters/{convert-query-categories.test.ts → __tests__/convert-query-categories.test.ts} +1 -1
  46. package/runtime/utils/converters/{convert-snake-keys-to-camel.test.ts → __tests__/convert-snake-keys-to-camel.test.ts} +1 -1
  47. package/runtime/utils/converters/{convert-string-array-to-chips.test.ts → __tests__/convert-string-array-to-chips.test.ts} +1 -1
  48. package/runtime/utils/converters/{convert-string.test.ts → __tests__/convert-string.test.ts} +1 -1
  49. package/runtime/utils/converters/{group-categories-by-first-letter.test.ts → __tests__/group-categories-by-first-letter.test.ts} +1 -1
  50. package/runtime/utils/converters/{group-objects-by-first-letter.test.ts → __tests__/group-objects-by-first-letter.test.ts} +1 -1
  51. package/runtime/utils/converters/convert-channel-to-round-card.ts +11 -0
  52. package/runtime/utils/converters/convert-model-to-round-card.ts +11 -0
  53. package/runtime/utils/server/{parse-api-error.test.ts → __tests__/parse-api-error.test.ts} +1 -1
  54. package/types/index.d.ts +1 -0
  55. package/types/round-card.d.ts +6 -0
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment nuxt
2
2
  import { describe, it, expect } from 'vitest';
3
- import { useFilterScheme } from './use-filter-scheme';
3
+ import { useFilterScheme } from '../use-filter-scheme';
4
4
 
5
5
  const t = (key: string) => key;
6
6
 
@@ -5,7 +5,7 @@ vi.mock('vue-router', () => ({
5
5
  }));
6
6
 
7
7
  import { useRoute } from 'vue-router';
8
- import { useGetPureRouteName } from './use-get-pure-route-name';
8
+ import { useGetPureRouteName } from '../use-get-pure-route-name';
9
9
 
10
10
  describe('useGetPureRouteName', () => {
11
11
  it('убирает суффикс ___en', () => {
@@ -1,10 +1,10 @@
1
1
  import { vi, describe, it, expect } from 'vitest';
2
2
 
3
- vi.mock('../runtime', () => ({
3
+ vi.mock('../../runtime', () => ({
4
4
  getMultipleQuery: () => ({}),
5
5
  }));
6
6
 
7
- import { useGetVideosFilterRequest } from './use-get-videos-filter-request';
7
+ import { useGetVideosFilterRequest } from '../use-get-videos-filter-request';
8
8
 
9
9
  describe('useGetVideosFilterRequest', () => {
10
10
  it('всегда возвращает categories_filter_use_and', () => {
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment nuxt
2
2
  import { describe, it, expect } from 'vitest';
3
- import { useFilterChipsItems } from './use-model-filter-chips';
3
+ import { useFilterChipsItems } from '../use-model-filter-chips';
4
4
 
5
5
  const t = (key: string) => key;
6
6
 
@@ -1,7 +1,7 @@
1
1
  // @vitest-environment nuxt
2
2
  import { describe, it, expect, beforeEach } from 'vitest';
3
3
  import { mockNuxtImport } from '@nuxt/test-utils/runtime';
4
- import { useSeoLinks } from './use-seo-links';
4
+ import { useSeoLinks } from '../use-seo-links';
5
5
 
6
6
  let mockRoute = { path: '/videos', query: {} as Record<string, any> };
7
7
 
@@ -7,7 +7,7 @@ vi.mock('vue-router', async (importOriginal) => {
7
7
  });
8
8
 
9
9
  import { useRoute } from 'vue-router';
10
- import { useSlug } from './use-slug';
10
+ import { useSlug } from '../use-slug';
11
11
 
12
12
  describe('useSlug', () => {
13
13
  it('конвертирует kebab-case slug', () => {
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment nuxt
2
2
  import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
3
- import { useSnackbar } from './use-snackbar';
3
+ import { useSnackbar } from '../use-snackbar';
4
4
 
5
5
  describe('useSnackbar', () => {
6
6
  beforeEach(() => {
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment nuxt
2
2
  import { describe, it, expect, beforeEach } from 'vitest';
3
- import { useUnits } from './use-units';
3
+ import { useUnits } from '../use-units';
4
4
 
5
5
  describe('useUnits', () => {
6
6
  beforeEach(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.713",
4
+ "version": "0.0.715",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
package/runtime/index.ts CHANGED
@@ -51,6 +51,8 @@ export * from './utils/server/server-api-helper';
51
51
  export * from './utils/converters/convert-date-to-timestamp';
52
52
  export * from './utils/get-month';
53
53
  export * from './utils/converters/convert-string';
54
+ export * from './utils/converters/convert-model-to-round-card';
55
+ export * from './utils/converters/convert-channel-to-round-card';
54
56
  export * from './utils/normalize-url';
55
57
  export * from './utils/check-device-width';
56
58
  export * from './utils/is-mobile-device';
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { formatDate } from './format-date';
2
+ import { formatDate } from '../format-date';
3
3
 
4
4
  describe('formatDate', () => {
5
5
  it('обычная дата', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { formatNumber } from './format-number';
2
+ import { formatNumber } from '../format-number';
3
3
 
4
4
  describe('formatNumber', () => {
5
5
  it('тысячи', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
- import { formatTimeAgo } from './format-time-ago';
2
+ import { formatTimeAgo } from '../format-time-ago';
3
3
 
4
4
  const t = (key: string) => key;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { formatTime } from './format-time';
2
+ import { formatTime } from '../format-time';
3
3
 
4
4
  describe('formatTime', () => {
5
5
  it('только секунды', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getDuration } from './get-duration';
2
+ import { getDuration } from '../get-duration';
3
3
 
4
4
  describe('getDuration', () => {
5
5
  it('только секунды', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getMonth } from './get-month';
2
+ import { getMonth } from '../get-month';
3
3
 
4
4
  const t = (key: string) => key;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getMultipleQuery } from './get-multiple-query';
2
+ import { getMultipleQuery } from '../get-multiple-query';
3
3
 
4
4
  describe('getMultipleQuery', () => {
5
5
  const route = { query: { duration: '10-30' } };
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getSelectedQuery } from './get-selected-query';
2
+ import { getSelectedQuery } from '../get-selected-query';
3
3
 
4
4
  describe('getSelectedQuery', () => {
5
5
  it('находит query по значению из route', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { isMobileDevice } from './is-mobile-device';
2
+ import { isMobileDevice } from '../is-mobile-device';
3
3
 
4
4
  describe('isMobileDevice', () => {
5
5
  it('Android', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { normalizeUrl } from './normalize-url';
2
+ import { normalizeUrl } from '../normalize-url';
3
3
 
4
4
  describe('normalizeUrl', () => {
5
5
  it('удаляет page=1', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { validateEmail } from './validate-email';
2
+ import { validateEmail } from '../validate-email';
3
3
 
4
4
  describe('validateEmail', () => {
5
5
  it('валидный email', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { validatePassword } from './validate-password';
2
+ import { validatePassword } from '../validate-password';
3
3
 
4
4
  describe('validatePassword', () => {
5
5
  it('длина > 4 — валиден', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { validatePhone } from './validate-phone';
2
+ import { validatePhone } from '../validate-phone';
3
3
 
4
4
  describe('validatePhone', () => {
5
5
  it('международный формат', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { validateUsername } from './validate-username';
2
+ import { validateUsername } from '../validate-username';
3
3
 
4
4
  describe('validateUsername', () => {
5
5
  it('латиница', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { videoDataAddModelIcon } from './video-data-add-model-icon';
2
+ import { videoDataAddModelIcon } from '../video-data-add-model-icon';
3
3
 
4
4
  describe('videoDataAddModelIcon', () => {
5
5
  it('добавляет icon к matching модели', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanCategoryCard } from './clean-category-card';
2
+ import { cleanCategoryCard } from '../clean-category-card';
3
3
 
4
4
  describe('cleanCategoryCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanCategoryInfo } from './clean-category-info';
2
+ import { cleanCategoryInfo } from '../clean-category-info';
3
3
 
4
4
  describe('cleanCategoryInfo', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanChannelCard } from './clean-channel-card';
2
+ import { cleanChannelCard } from '../clean-channel-card';
3
3
 
4
4
  describe('cleanChannelCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanChannelInfo } from './clean-channel-info';
2
+ import { cleanChannelInfo } from '../clean-channel-info';
3
3
 
4
4
  describe('cleanChannelInfo', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanMiniCategoryCard } from './clean-mini-category-card';
2
+ import { cleanMiniCategoryCard } from '../clean-mini-category-card';
3
3
 
4
4
  describe('cleanMiniCategoryCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanModelCard } from './clean-model-card';
2
+ import { cleanModelCard } from '../clean-model-card';
3
3
 
4
4
  const makeRaw = (overrides = {}) => ({
5
5
  title: 'Model Name',
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanPlaylistCard } from './clean-playlist-card';
2
+ import { cleanPlaylistCard } from '../clean-playlist-card';
3
3
 
4
4
  describe('cleanPlaylistCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanPlaylistData } from './clean-playlist-data';
2
+ import { cleanPlaylistData } from '../clean-playlist-data';
3
3
 
4
4
  describe('cleanPlaylistData', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanPlaylistVideo } from './clean-playlist-video';
2
+ import { cleanPlaylistVideo } from '../clean-playlist-video';
3
3
 
4
4
  describe('cleanPlaylistVideo', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanProfileData } from './clean-profile-data';
2
+ import { cleanProfileData } from '../clean-profile-data';
3
3
 
4
4
  describe('cleanProfileData', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanUserPlaylistCard } from './clean-user-playlists-card';
2
+ import { cleanUserPlaylistCard } from '../clean-user-playlists-card';
3
3
 
4
4
  describe('cleanUserPlaylistCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanVideoCard } from './clean-video-card';
2
+ import { cleanVideoCard } from '../clean-video-card';
3
3
 
4
4
  describe('cleanVideoCard', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { cleanVideoData } from './clean-video-data';
2
+ import { cleanVideoData } from '../clean-video-data';
3
3
 
4
4
  describe('cleanVideoData', () => {
5
5
  it('полные данные', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertCategoriesToChips } from './convert-categories-to-chips';
2
+ import { convertCategoriesToChips } from '../convert-categories-to-chips';
3
3
 
4
4
  describe('convertCategoriesToChips', () => {
5
5
  it('конвертирует массив категорий в чипсы', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertCategoriesToFooter } from './convert-categories-to-footer';
2
+ import { convertCategoriesToFooter } from '../convert-categories-to-footer';
3
3
 
4
4
  describe('convertCategoriesToFooter', () => {
5
5
  it('конвертирует категории в футер', () => {
@@ -0,0 +1,37 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { convertChannelToRoundCard } from '../convert-channel-to-round-card';
3
+
4
+ describe('convertChannelToRoundCard', () => {
5
+ it('конвертирует канал в round card', () => {
6
+ const channel = {
7
+ guid: 'ch-1',
8
+ name: 'Channel Name',
9
+ url: '/channels/1',
10
+ videosCount: 50,
11
+ isNetwork: false,
12
+ updated: 0,
13
+ avatarUrl: 'https://img.com/avatar.jpg',
14
+ description: '',
15
+ };
16
+ const result = convertChannelToRoundCard(channel);
17
+ expect(result.title).toBe('Channel Name');
18
+ expect(result.primaryImageUrl).toBe('https://img.com/avatar.jpg');
19
+ expect(result.videosCount).toBe(50);
20
+ expect(result.link).toBe('/channels/channel-name');
21
+ });
22
+
23
+ it('slug с заглавными', () => {
24
+ const channel = {
25
+ guid: 'ch-2',
26
+ name: 'Big Studio',
27
+ url: '',
28
+ videosCount: 0,
29
+ isNetwork: false,
30
+ updated: 0,
31
+ avatarUrl: '',
32
+ description: '',
33
+ };
34
+ const result = convertChannelToRoundCard(channel);
35
+ expect(result.link).toBe('/channels/big-studio');
36
+ });
37
+ });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertDateToTimestamp } from './convert-date-to-timestamp';
2
+ import { convertDateToTimestamp } from '../convert-date-to-timestamp';
3
3
 
4
4
  const c = convertDateToTimestamp();
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertModelCardToChips } from './convert-model-card-to-chips';
2
+ import { convertModelCardToChips } from '../convert-model-card-to-chips';
3
3
 
4
4
  describe('convertModelCardToChips', () => {
5
5
  it('конвертирует карточки моделей в чипсы', () => {
@@ -0,0 +1,59 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { convertModelToRoundCard } from '../convert-model-to-round-card';
3
+
4
+ describe('convertModelToRoundCard', () => {
5
+ it('конвертирует модель в round card', () => {
6
+ const model = {
7
+ title: 'Model Name',
8
+ primaryImageUrl: 'https://img.com/primary.jpg',
9
+ thumbUrl: 'https://img.com/thumb.jpg',
10
+ videosCount: 10,
11
+ guid: 'm-1',
12
+ parameters: [],
13
+ };
14
+ const result = convertModelToRoundCard(model);
15
+ expect(result.title).toBe('Model Name');
16
+ expect(result.primaryImageUrl).toBe('https://img.com/primary.jpg');
17
+ expect(result.videosCount).toBe(10);
18
+ expect(result.link).toBe('/models/model-name');
19
+ });
20
+
21
+ it('без primaryImageUrl → использует thumbUrl', () => {
22
+ const model = {
23
+ title: 'Test',
24
+ primaryImageUrl: '',
25
+ thumbUrl: 'https://img.com/thumb.jpg',
26
+ videosCount: 5,
27
+ guid: 'm-2',
28
+ parameters: [],
29
+ };
30
+ const result = convertModelToRoundCard(model);
31
+ expect(result.primaryImageUrl).toBe('https://img.com/thumb.jpg');
32
+ });
33
+
34
+ it('без обоих url → пустая строка', () => {
35
+ const model = {
36
+ title: 'Test',
37
+ primaryImageUrl: '',
38
+ thumbUrl: '',
39
+ videosCount: 0,
40
+ guid: 'm-3',
41
+ parameters: [],
42
+ };
43
+ const result = convertModelToRoundCard(model);
44
+ expect(result.primaryImageUrl).toBe('');
45
+ });
46
+
47
+ it('slug с пробелами и заглавными', () => {
48
+ const model = {
49
+ title: 'Big Name Model',
50
+ primaryImageUrl: 'url',
51
+ thumbUrl: '',
52
+ videosCount: 0,
53
+ guid: 'm-4',
54
+ parameters: [],
55
+ };
56
+ const result = convertModelToRoundCard(model);
57
+ expect(result.link).toBe('/models/big-name-model');
58
+ });
59
+ });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertQueryCategories } from './convert-query-categories';
2
+ import { convertQueryCategories } from '../convert-query-categories';
3
3
 
4
4
  describe('convertQueryCategories', () => {
5
5
  it('конвертирует query категории', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertSnakeKeysToCamel } from './convert-snake-keys-to-camel';
2
+ import { convertSnakeKeysToCamel } from '../convert-snake-keys-to-camel';
3
3
 
4
4
  describe('convertSnakeKeysToCamel', () => {
5
5
  it('простой объект', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertStringArrayToChips } from './convert-string-array-to-chips';
2
+ import { convertStringArrayToChips } from '../convert-string-array-to-chips';
3
3
 
4
4
  describe('convertStringArrayToChips', () => {
5
5
  it('конвертирует массив строк в чипсы', () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { convertString } from './convert-string';
2
+ import { convertString } from '../convert-string';
3
3
 
4
4
  const s = convertString();
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { groupCategoriesByFirstLetter } from './group-categories-by-first-letter';
2
+ import { groupCategoriesByFirstLetter } from '../group-categories-by-first-letter';
3
3
 
4
4
  const items = [
5
5
  { title: 'Amateur', name: 'amateur', videosCount: 10, guid: '1', icon: '', is_top: false },
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { groupObjectsByFirstLetter } from './group-objects-by-first-letter';
2
+ import { groupObjectsByFirstLetter } from '../group-objects-by-first-letter';
3
3
 
4
4
  describe('groupObjectsByFirstLetter', () => {
5
5
  const items = [
@@ -0,0 +1,11 @@
1
+ import type { IChannelCard, IRoundCard } from '../../../types';
2
+ import { convertString } from './convert-string';
3
+
4
+ export function convertChannelToRoundCard(channel: IChannelCard): IRoundCard {
5
+ return {
6
+ title: channel.name,
7
+ primaryImageUrl: channel.avatarUrl,
8
+ videosCount: channel.videosCount,
9
+ link: `/channels/${convertString().toSlug(channel.name)}`,
10
+ };
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { IModelCard, IRoundCard } from '../../../types';
2
+ import { convertString } from './convert-string';
3
+
4
+ export function convertModelToRoundCard(model: IModelCard): IRoundCard {
5
+ return {
6
+ title: model.title,
7
+ primaryImageUrl: model.primaryImageUrl || model.thumbUrl || '',
8
+ videosCount: model.videosCount,
9
+ link: `/models/${convertString().toSlug(model.title)}`,
10
+ };
11
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { parseApiError } from './parse-api-error';
2
+ import { parseApiError } from '../parse-api-error';
3
3
 
4
4
  describe('parseApiError', () => {
5
5
  it('error.message', () => {
package/types/index.d.ts CHANGED
@@ -66,3 +66,4 @@ export * from './playlist-short.d.ts';
66
66
  export * from './info-chips.d.ts';
67
67
  export * from './model-parameter.d.ts';
68
68
  export * from './grouped-parameter.d.ts';
69
+ export * from './round-card.d.ts';
@@ -0,0 +1,6 @@
1
+ export interface IRoundCard {
2
+ title: string
3
+ primaryImageUrl: string
4
+ videosCount: number
5
+ link: string
6
+ }