musora-content-services 2.98.0 → 2.99.0
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.
- package/.coderabbit.yaml +0 -0
- package/.editorconfig +0 -0
- package/.github/pull_request_template.md +0 -0
- package/.github/workflows/conventional-commits.yaml +0 -0
- package/.github/workflows/docs.js.yml +0 -0
- package/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/CHANGELOG.md +7 -0
- package/README.md +0 -0
- package/jest.config.js +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/contentTypeConfig.js +23 -30
- package/src/filterBuilder.js +8 -0
- package/src/infrastructure/http/HttpClient.ts +0 -0
- package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
- package/src/infrastructure/http/index.ts +0 -0
- package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
- package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
- package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
- package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
- package/src/lib/brands.ts +0 -0
- package/src/lib/httpHelper.js +0 -0
- package/src/lib/lastUpdated.js +0 -0
- package/src/services/api/types.js +0 -0
- package/src/services/api/types.ts +0 -0
- package/src/services/content/content.ts +0 -0
- package/src/services/content-org/content-org.js +0 -0
- package/src/services/content-org/guided-courses.ts +0 -0
- package/src/services/content-org/playlists-types.js +0 -0
- package/src/services/content-org/playlists.js +0 -0
- package/src/services/content.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/dateUtils.js +0 -0
- package/src/services/eventsAPI.js +0 -0
- package/src/services/forums/categories.ts +0 -0
- package/src/services/forums/forums.ts +0 -0
- package/src/services/forums/posts.ts +0 -0
- package/src/services/forums/threads.ts +0 -0
- package/src/services/forums/types.ts +0 -0
- package/src/services/gamification/gamification.js +0 -0
- package/src/services/imageSRCBuilder.js +0 -0
- package/src/services/imageSRCVerify.js +0 -0
- package/src/services/liveTesting.ts +0 -0
- package/src/services/permissions/PermissionsAdapter.ts +0 -0
- package/src/services/permissions/PermissionsAdapterFactory.ts +0 -0
- package/src/services/permissions/PermissionsV1Adapter.ts +0 -0
- package/src/services/permissions/PermissionsV2Adapter.ts +0 -0
- package/src/services/permissions/README.md +0 -0
- package/src/services/permissions/index.ts +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/recommendations.js +0 -0
- package/src/services/reporting/README.md +0 -0
- package/src/services/reporting/reporting.ts +0 -0
- package/src/services/reporting/types.ts +0 -0
- package/src/services/sentry/.indexignore +0 -0
- package/src/services/sentry/index.ts +0 -0
- package/src/services/sync/.indexignore +0 -0
- package/src/services/sync/adapters/factory.ts +0 -0
- package/src/services/sync/adapters/lokijs.ts +0 -0
- package/src/services/sync/adapters/sqlite.ts +0 -0
- package/src/services/sync/concurrency-safety.ts +0 -0
- package/src/services/sync/context/index.ts +0 -0
- package/src/services/sync/context/providers/base.ts +0 -0
- package/src/services/sync/context/providers/connectivity.ts +0 -0
- package/src/services/sync/context/providers/durability.ts +0 -0
- package/src/services/sync/context/providers/index.ts +0 -0
- package/src/services/sync/context/providers/session.ts +0 -0
- package/src/services/sync/context/providers/tabs.ts +0 -0
- package/src/services/sync/context/providers/visibility.ts +0 -0
- package/src/services/sync/database/factory.ts +0 -0
- package/src/services/sync/errors/boundary.ts +0 -0
- package/src/services/sync/errors/index.ts +0 -0
- package/src/services/sync/index.ts +0 -0
- package/src/services/sync/models/Base.ts +0 -0
- package/src/services/sync/models/ContentLike.ts +0 -0
- package/src/services/sync/models/Practice.ts +0 -0
- package/src/services/sync/models/PracticeDayNote.ts +0 -0
- package/src/services/sync/repositories/base.ts +0 -0
- package/src/services/sync/repositories/content-likes.ts +0 -0
- package/src/services/sync/repositories/practice-day-notes.ts +0 -0
- package/src/services/sync/resolver.ts +0 -0
- package/src/services/sync/run-scope.ts +0 -0
- package/src/services/sync/serializers/index.ts +0 -0
- package/src/services/sync/serializers/model.ts +0 -0
- package/src/services/sync/serializers/raw.ts +0 -0
- package/src/services/sync/strategies/base.ts +0 -0
- package/src/services/sync/strategies/index.ts +0 -0
- package/src/services/sync/strategies/initial.ts +0 -0
- package/src/services/sync/strategies/polling.ts +0 -0
- package/src/services/sync/telemetry/index.ts +0 -0
- package/src/services/sync/telemetry/sampling.ts +0 -0
- package/src/services/sync/utils/event-emitter.ts +0 -0
- package/src/services/sync/utils/index.ts +0 -0
- package/src/services/sync/utils/throttle.ts +0 -0
- package/src/services/sync/utils/timers.ts +0 -0
- package/src/services/types.js +0 -0
- package/src/services/user/account.ts +0 -0
- package/src/services/user/chat.js +0 -0
- package/src/services/user/interests.js +0 -0
- package/src/services/user/management.js +0 -0
- package/src/services/user/notifications.js +0 -0
- package/src/services/user/payments.ts +0 -0
- package/src/services/user/permissions.js +0 -0
- package/src/services/user/profile.js +0 -0
- package/src/services/user/sessions.js +0 -0
- package/src/services/user/types.d.ts +0 -0
- package/src/services/user/types.js +0 -0
- package/src/services/user/user-management-system.js +0 -0
- package/src/services/userActivity.js +3 -2
- package/test/content.test.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/dataContext.test.js +0 -0
- package/test/forum.test.js +0 -0
- package/test/imageSRCBuilder.test.js +0 -0
- package/test/imageSRCVerify.test.js +0 -0
- package/test/lib/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
- package/test/mockData/mockData_progress_content.json +0 -0
- package/test/mockData/mockData_sanity_progress_content.json +0 -0
- package/test/mockData/mockData_user_practices.json +0 -0
- package/test/notifications.test.js +0 -0
- package/test/progressRows.test.js +0 -0
- package/test/streakMessage.test.js +0 -0
- package/test/user/permissions.test.js +0 -0
- package/test/userActivity.test.js +0 -0
- package/.claude/settings.local.json +0 -14
- package/.yarnrc.yml +0 -1
- package/test/reporting.test.js +0 -132
package/.coderabbit.yaml
CHANGED
|
File without changes
|
package/.editorconfig
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.prettierignore
CHANGED
|
File without changes
|
package/.prettierrc
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.99.0](https://github.com/railroadmedia/musora-content-services/compare/v2.98.0...v2.99.0) (2025-12-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **BEH-1421:** Content Migration : child lesson type migrations ([#624](https://github.com/railroadmedia/musora-content-services/issues/624)) ([77300ed](https://github.com/railroadmedia/musora-content-services/commit/77300eddabc4deed46c26f7b1291d9540a3ef486))
|
|
11
|
+
|
|
5
12
|
## [2.98.0](https://github.com/railroadmedia/musora-content-services/compare/v2.94.7...v2.98.0) (2025-12-09)
|
|
6
13
|
|
|
7
14
|
|
package/README.md
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/contentTypeConfig.js
CHANGED
|
@@ -6,21 +6,19 @@ export const AWSUrl = 'https://s3.us-east-1.amazonaws.com/musora-web-platform'
|
|
|
6
6
|
export const CloudFrontURl = 'https://d3fzm1tzeyr5n3.cloudfront.net'
|
|
7
7
|
|
|
8
8
|
// This is used to pull related content by license, so we only show "consumable" content
|
|
9
|
-
export const SONG_TYPES = ['song', 'play-along', 'jam-track', 'song-tutorial-
|
|
9
|
+
export const SONG_TYPES = ['song', 'play-along', 'jam-track', 'song-tutorial-lesson']
|
|
10
10
|
// Oct 2025: It turns out content-meta categories are not really clear
|
|
11
11
|
// THis is used for the page_type field as a post processor so we include parents and children
|
|
12
12
|
// Duplicated in SanityGateway.php if you update this, update that
|
|
13
13
|
export const SONG_TYPES_WITH_CHILDREN = [
|
|
14
14
|
'song',
|
|
15
|
-
'song-part',
|
|
16
15
|
'play-along',
|
|
17
|
-
'play-along-part',
|
|
18
16
|
'jam-track',
|
|
19
17
|
'song-tutorial',
|
|
20
|
-
'song-tutorial-
|
|
18
|
+
'song-tutorial-lesson',
|
|
21
19
|
]
|
|
22
20
|
// Single hierarchy refers to only one element in the hierarchy has video lessons, not that they have a single parent
|
|
23
|
-
export const SINGLE_PARENT_TYPES = ['course-
|
|
21
|
+
export const SINGLE_PARENT_TYPES = ['course-lesson', 'pack-bundle-lesson', 'song-tutorial-lesson']
|
|
24
22
|
|
|
25
23
|
export const genreField = `genre[]->{
|
|
26
24
|
name,
|
|
@@ -175,7 +173,7 @@ export const showsTypes = {
|
|
|
175
173
|
|
|
176
174
|
export const coachLessonsTypes = [
|
|
177
175
|
'course',
|
|
178
|
-
'course-
|
|
176
|
+
'course-lesson',
|
|
179
177
|
'coach-stream',
|
|
180
178
|
'student-focus',
|
|
181
179
|
'quick-tips',
|
|
@@ -183,7 +181,7 @@ export const coachLessonsTypes = [
|
|
|
183
181
|
'semester-pack',
|
|
184
182
|
'question-and-answer',
|
|
185
183
|
'song-tutorial',
|
|
186
|
-
'song-tutorial-
|
|
184
|
+
'song-tutorial-lesson',
|
|
187
185
|
'workout',
|
|
188
186
|
]
|
|
189
187
|
|
|
@@ -192,15 +190,8 @@ export const childContentTypeConfig = {
|
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
export const singleLessonTypes = ['quick-tips', 'rudiment']
|
|
195
|
-
export const practiceAlongsLessonTypes = ['workout']
|
|
193
|
+
export const practiceAlongsLessonTypes = ['workout']
|
|
196
194
|
export const performancesLessonTypes = ['performance']
|
|
197
|
-
export const documentariesLessonTypes = [
|
|
198
|
-
'tama',
|
|
199
|
-
'sonor',
|
|
200
|
-
'history-of-electronic-drums',
|
|
201
|
-
'paiste-cymbals',
|
|
202
|
-
'backstage-secret',
|
|
203
|
-
]
|
|
204
195
|
export const liveArchivesLessonTypes = [
|
|
205
196
|
'podcast',
|
|
206
197
|
'coach-stream',
|
|
@@ -235,16 +226,18 @@ export const skillLessonTypes = ['skill-pack']
|
|
|
235
226
|
|
|
236
227
|
export const showsLessonTypes = [
|
|
237
228
|
'boot-camp',
|
|
238
|
-
'diy-drum-experiment',
|
|
239
|
-
'exploring-beats',
|
|
240
|
-
'in-rhythm',
|
|
241
|
-
'rhythmic-adventures-of-captain-carson',
|
|
242
|
-
'rhythms-from-another-planet',
|
|
243
229
|
'study-the-greats',
|
|
230
|
+
// TODO these require clearing the information with Chris, they weren't part of the old system, but are part of the migration document as SHOWS
|
|
231
|
+
// 'gear-guide',
|
|
232
|
+
// 'odd-times',
|
|
233
|
+
// 'podcast',
|
|
234
|
+
// 'spotlight',
|
|
235
|
+
// 'study-the-greats',
|
|
236
|
+
// 'performance',
|
|
244
237
|
]
|
|
245
238
|
export const entertainmentLessonTypes = [
|
|
246
|
-
'
|
|
247
|
-
|
|
239
|
+
'special',
|
|
240
|
+
'documentary-lesson',
|
|
248
241
|
...showsLessonTypes,
|
|
249
242
|
]
|
|
250
243
|
export const collectionLessonTypes = [...coursesLessonTypes, ...showsLessonTypes]
|
|
@@ -255,7 +248,7 @@ export const lessonTypesMapping = {
|
|
|
255
248
|
'live archives': liveArchivesLessonTypes,
|
|
256
249
|
performances: performancesLessonTypes,
|
|
257
250
|
'student archives': studentArchivesLessonTypes,
|
|
258
|
-
documentaries:
|
|
251
|
+
documentaries: ['documentary-lesson'],
|
|
259
252
|
courses: ['course'],
|
|
260
253
|
'guided courses': ['guided-course'],
|
|
261
254
|
'tiered courses': ['tiered-course'],
|
|
@@ -296,20 +289,20 @@ export const progressTypesMapping = {
|
|
|
296
289
|
...liveArchivesLessonTypes,
|
|
297
290
|
...performancesLessonTypes,
|
|
298
291
|
...studentArchivesLessonTypes,
|
|
299
|
-
|
|
292
|
+
'documentary-lesson',
|
|
300
293
|
'live',
|
|
301
294
|
'pack-bundle-lesson',
|
|
302
295
|
],
|
|
303
296
|
course: ['course'],
|
|
304
297
|
show: showsLessonTypes,
|
|
305
|
-
'song tutorial': [...tutorialsLessonTypes, 'song-tutorial-
|
|
298
|
+
'song tutorial': [...tutorialsLessonTypes, 'song-tutorial-lesson'],
|
|
306
299
|
songs: transcriptionsLessonTypes,
|
|
307
300
|
'play along': playAlongLessonTypes,
|
|
308
301
|
'guided course': ['guided-course'],
|
|
309
302
|
pack: ['pack', 'semester-pack'],
|
|
310
303
|
'learning path': ['learning-path-v2'],
|
|
311
304
|
'jam track': jamTrackLessonTypes,
|
|
312
|
-
'course video': ['course-
|
|
305
|
+
'course video': ['course-lesson'],
|
|
313
306
|
}
|
|
314
307
|
|
|
315
308
|
export const songs = {
|
|
@@ -341,9 +334,9 @@ export const filterTypes = {
|
|
|
341
334
|
export const recentTypes = {
|
|
342
335
|
lessons: [
|
|
343
336
|
...individualLessonsTypes,
|
|
344
|
-
'course-
|
|
337
|
+
'course-lesson',
|
|
345
338
|
'pack-bundle-lesson',
|
|
346
|
-
'guided-course-
|
|
339
|
+
'guided-course-lesson',
|
|
347
340
|
'quick-tips',
|
|
348
341
|
],
|
|
349
342
|
songs: [...SONG_TYPES],
|
|
@@ -420,7 +413,7 @@ export let contentTypeConfig = {
|
|
|
420
413
|
},
|
|
421
414
|
},
|
|
422
415
|
},
|
|
423
|
-
'song-tutorial-
|
|
416
|
+
'song-tutorial-lesson': {
|
|
424
417
|
fields: [`"resources": ${resourcesField}`],
|
|
425
418
|
},
|
|
426
419
|
'guided-course': {
|
|
@@ -633,7 +626,7 @@ export let contentTypeConfig = {
|
|
|
633
626
|
live: { ...contentWithInstructorsField, slug: 'live-streams' },
|
|
634
627
|
solo: { ...contentWithInstructorsField, slug: 'solos' },
|
|
635
628
|
'boot-camp': contentWithInstructorsField,
|
|
636
|
-
'gear-
|
|
629
|
+
'gear-guide': contentWithInstructorsField,
|
|
637
630
|
performance: contentWithInstructorsField,
|
|
638
631
|
challenges: contentWithInstructorsField,
|
|
639
632
|
'on-the-road': contentWithInstructorsField,
|
package/src/filterBuilder.js
CHANGED
|
@@ -67,6 +67,7 @@ export class FilterBuilder {
|
|
|
67
67
|
|
|
68
68
|
if (this.debug) console.log('baseFilter', this.filter)
|
|
69
69
|
const filter = this._applyContentStatuses()
|
|
70
|
+
._removeDeprecatedContent()
|
|
70
71
|
._applyPermissions()
|
|
71
72
|
._applyPublishingDateRestrictions()
|
|
72
73
|
._trimAmpersands().filter // just in case
|
|
@@ -83,6 +84,13 @@ export class FilterBuilder {
|
|
|
83
84
|
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), 1)
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
_removeDeprecatedContent() {
|
|
88
|
+
this._andWhere(
|
|
89
|
+
`!defined(${this.prefix}deprecated_railcontent_id)`
|
|
90
|
+
)
|
|
91
|
+
return this
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
_applyContentStatuses() {
|
|
87
95
|
// This must be run before _applyPublishDateRestrictions()
|
|
88
96
|
if (this.bypassStatuses) return this
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/lib/brands.ts
CHANGED
|
File without changes
|
package/src/lib/httpHelper.js
CHANGED
|
File without changes
|
package/src/lib/lastUpdated.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/content.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/types.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -922,7 +922,7 @@ async function extractPinnedItemsAndSortAllItems(
|
|
|
922
922
|
}
|
|
923
923
|
|
|
924
924
|
function generateContentsMap(contents, playlistsContents) {
|
|
925
|
-
const excludedTypes = new Set(['pack-bundle', 'guided-course-
|
|
925
|
+
const excludedTypes = new Set(['pack-bundle', 'guided-course-lesson'])
|
|
926
926
|
const existingShows = new Set()
|
|
927
927
|
const contentsMap = new Map()
|
|
928
928
|
const childToParentMap = {}
|
|
@@ -1097,7 +1097,8 @@ async function processContentItem(content) {
|
|
|
1097
1097
|
const progressTimestamp = content.progressTimestamp
|
|
1098
1098
|
const wasPinned = content.pinned ?? false
|
|
1099
1099
|
if (content.progressStatus === 'completed') {
|
|
1100
|
-
// this could be handled more gracefully if
|
|
1100
|
+
// this could be handled more gracefully if there was a parent content type for shows
|
|
1101
|
+
// Update Dec 3rd. We updated almost everything to the DocumentaryType :D, but there's still a few
|
|
1101
1102
|
const nextByProgress = findIncompleteLesson(progressOnItems, content.id, content.type)
|
|
1102
1103
|
content = shows.find((lesson) => lesson.id === nextByProgress)
|
|
1103
1104
|
content.completed_children = completedShows
|
package/test/content.test.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/dataContext.test.js
CHANGED
|
File without changes
|
package/test/forum.test.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
package/test/reporting.test.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Reporting Service
|
|
3
|
-
*
|
|
4
|
-
* Note: These tests use mocked HTTP calls. For integration tests,
|
|
5
|
-
* ensure the backend API is running at the configured baseUrl.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { initializeTestService } from './initializeTests.js'
|
|
9
|
-
import {
|
|
10
|
-
reportContent,
|
|
11
|
-
reportForumPost,
|
|
12
|
-
submitReport
|
|
13
|
-
} from '../src/services/reporting/reporting.ts'
|
|
14
|
-
|
|
15
|
-
// Mock HttpClient to avoid actual API calls in tests
|
|
16
|
-
jest.mock('../src/infrastructure/http/HttpClient', () => {
|
|
17
|
-
return {
|
|
18
|
-
HttpClient: jest.fn().mockImplementation(() => ({
|
|
19
|
-
post: jest.fn().mockResolvedValue({
|
|
20
|
-
report_id: 12345,
|
|
21
|
-
message: 'Report submitted successfully',
|
|
22
|
-
is_duplicate: false
|
|
23
|
-
})
|
|
24
|
-
}))
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
describe('Reporting Service', () => {
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
initializeTestService()
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
describe('reportContent', () => {
|
|
34
|
-
test('should submit a content report with video_not_working category', async () => {
|
|
35
|
-
const result = await reportContent({
|
|
36
|
-
contentId: 123,
|
|
37
|
-
category: 'video_not_working',
|
|
38
|
-
description: 'Video freezes at 2:30'
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
expect(result).toBeDefined()
|
|
42
|
-
expect(result.report_id).toBe(12345)
|
|
43
|
-
expect(result.message).toBe('Report submitted successfully')
|
|
44
|
-
expect(result.is_duplicate).toBe(false)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
test('should submit a content report without description', async () => {
|
|
48
|
-
const result = await reportContent({
|
|
49
|
-
contentId: 456,
|
|
50
|
-
category: 'incorrect_content'
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
expect(result).toBeDefined()
|
|
54
|
-
expect(result.report_id).toBeDefined()
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
test('should submit a content report with other category and description', async () => {
|
|
58
|
-
const result = await reportContent({
|
|
59
|
-
contentId: 789,
|
|
60
|
-
category: 'other',
|
|
61
|
-
description: 'Audio quality is very poor'
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
expect(result).toBeDefined()
|
|
65
|
-
expect(result.report_id).toBeDefined()
|
|
66
|
-
expect(result.message).toBeDefined()
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
describe('reportForumPost', () => {
|
|
71
|
-
test('should submit a forum post report with required brand', async () => {
|
|
72
|
-
const result = await reportForumPost({
|
|
73
|
-
postId: 555,
|
|
74
|
-
brand: 'drumeo',
|
|
75
|
-
category: 'spam'
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
expect(result).toBeDefined()
|
|
79
|
-
expect(result.report_id).toBeDefined()
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test('should submit a forum post report with description', async () => {
|
|
83
|
-
const result = await reportForumPost({
|
|
84
|
-
postId: 666,
|
|
85
|
-
brand: 'pianote',
|
|
86
|
-
category: 'harassment',
|
|
87
|
-
description: 'User is harassing other members'
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
expect(result).toBeDefined()
|
|
91
|
-
expect(result.report_id).toBeDefined()
|
|
92
|
-
expect(result.message).toBeDefined()
|
|
93
|
-
})
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
describe('submitReport', () => {
|
|
97
|
-
test('should submit a generic report for content', async () => {
|
|
98
|
-
const result = await submitReport({
|
|
99
|
-
reportableType: 'content',
|
|
100
|
-
reportableId: 999,
|
|
101
|
-
category: 'technical_issue',
|
|
102
|
-
description: 'Page not loading'
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
expect(result).toBeDefined()
|
|
106
|
-
expect(result.report_id).toBeDefined()
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
test('should submit a generic report for playlist', async () => {
|
|
110
|
-
const result = await submitReport({
|
|
111
|
-
reportableType: 'playlist',
|
|
112
|
-
reportableId: 777,
|
|
113
|
-
category: 'incorrect_content'
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
expect(result).toBeDefined()
|
|
117
|
-
expect(result.report_id).toBeDefined()
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
test('should submit a generic report for comment', async () => {
|
|
121
|
-
const result = await submitReport({
|
|
122
|
-
reportableType: 'comment',
|
|
123
|
-
reportableId: 888,
|
|
124
|
-
category: 'inappropriate',
|
|
125
|
-
description: 'Comment contains offensive language'
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
expect(result).toBeDefined()
|
|
129
|
-
expect(result.report_id).toBeDefined()
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
})
|