musora-content-services 1.0.193 → 1.0.194

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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
+ ### [1.0.194](https://github.com/railroadmedia/musora-content-services/compare/v1.0.193...v1.0.194) (2024-11-29)
6
+
5
7
  ### [1.0.193](https://github.com/railroadmedia/musora-content-services/compare/v1.0.192...v1.0.193) (2024-11-28)
6
8
 
7
9
  ### [1.0.192](https://github.com/railroadmedia/musora-content-services/compare/v1.0.191...v1.0.192) (2024-11-28)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.193",
3
+ "version": "1.0.194",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -641,7 +641,7 @@ async function handleCustomFetchAll(brand, type, {
641
641
  sort,
642
642
  includedFields,
643
643
  groupBy: '',
644
- completedIds,
644
+ progressIds: completedIds,
645
645
  useDefaultFields,
646
646
  customFields,
647
647
  progress
@@ -656,7 +656,7 @@ async function handleCustomFetchAll(brand, type, {
656
656
  sort,
657
657
  includedFields,
658
658
  groupBy: '',
659
- ownedIds,
659
+ progressIds: ownedIds,
660
660
  useDefaultFields,
661
661
  customFields,
662
662
  progress
@@ -1,4 +1,6 @@
1
1
  import {getFieldsForContentType} from "../src/contentTypeConfig";
2
+ const railContentModule = require('../src/services/railcontent.js')
3
+
2
4
  import {
3
5
  fetchAssignments,
4
6
  fetchCommentModContentData,
@@ -8,6 +10,7 @@ import {
8
10
  import {log} from './log.js';
9
11
  import {initializeTestService} from "./initializeTests";
10
12
  import {dataContext} from "../src/services/contentProgress";
13
+ import {fetchOwnedChallenges} from "../src";
11
14
 
12
15
  const {
13
16
  fetchSongById,
@@ -266,14 +269,21 @@ describe('Sanity Queries', function () {
266
269
  const response = await fetchAll('drumeo', 'challenge', {groupBy:'difficulty_string'});
267
270
  expect(response.entity[0].name).toBeDefined();
268
271
  expect(response.entity[0].lessons).toBeDefined();
269
- expect(response.entity[0].lessons.length).toBeGreaterThan(0)
272
+ expect(response.entity[0].lessons.length).toBeGreaterThan(0);
270
273
  });
271
274
 
272
- test('fetchAllChallengesByDifficulty', async () => {
273
- const response = await fetchAll('drumeo', 'challenge', {groupBy:'difficulty_string'});
274
- expect(response.entity[0].name).toBeDefined();
275
- expect(response.entity[0].lessons).toBeDefined();
276
- expect(response.entity[0].lessons.length).toBeGreaterThan(0)
275
+ test('fetchAllChallengesByCompleted', async () => {
276
+ var mock = jest.spyOn(railContentModule, 'fetchCompletedChallenges');
277
+ mock.mockImplementation(() => [402204]);
278
+ const response = await fetchAll('drumeo', 'challenge', {groupBy:'completed'});
279
+ expect(response.entity.length).toBe(1);
280
+ });
281
+
282
+ test('fetchAllChallengesByOwned', async () => {
283
+ var mock = jest.spyOn(railContentModule, 'fetchOwnedChallenges');
284
+ mock.mockImplementation(() => [402204]);
285
+ const response = await fetchAll('drumeo', 'challenge', {groupBy:'owned'});
286
+ expect(response.entity.length).toBe(1);
277
287
  });
278
288
 
279
289
  test('fetchAll-CustomFields', async () => {