Skip to content

Commit 88d94c4

Browse files
Merge pull request #9424 from Rakshitha-D/release_8.1.0
feat: Update client-services dependency and expand allowed roles for dial-code api's
2 parents 56ec713 + d1d61f1 commit 88d94c4

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

src/app/client/__mocks__/jsonld.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Mock for jsonld to avoid @digitalbazaar/http-client loading in tests
2+
3+
module.exports = {
4+
compact: jest.fn().mockResolvedValue({}),
5+
expand: jest.fn().mockResolvedValue([]),
6+
flatten: jest.fn().mockResolvedValue([]),
7+
frame: jest.fn().mockResolvedValue({}),
8+
fromRDF: jest.fn().mockResolvedValue({}),
9+
normalize: jest.fn().mockResolvedValue(''),
10+
toRDF: jest.fn().mockResolvedValue(''),
11+
__esModule: true,
12+
default: {
13+
compact: jest.fn().mockResolvedValue({}),
14+
expand: jest.fn().mockResolvedValue([]),
15+
flatten: jest.fn().mockResolvedValue([]),
16+
frame: jest.fn().mockResolvedValue({}),
17+
fromRDF: jest.fn().mockResolvedValue({}),
18+
normalize: jest.fn().mockResolvedValue(''),
19+
toRDF: jest.fn().mockResolvedValue(''),
20+
}
21+
};

src/app/client/jest-global-mocks.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ Object.defineProperty(document.body.style, 'transform', {
6363

6464
HTMLCanvasElement.prototype.getContext = <typeof HTMLCanvasElement.prototype.getContext>jest.fn();
6565

66-
// Polyfill for TextEncoder and TextDecoder
67-
const { TextEncoder, TextDecoder } = require('util');
68-
global.TextEncoder = TextEncoder;
69-
global.TextDecoder = TextDecoder;
66+
// Polyfill for TextEncoder and TextDecoder (if not already set)
67+
if (typeof global.TextEncoder === 'undefined') {
68+
const { TextEncoder, TextDecoder } = require('util');
69+
global.TextEncoder = TextEncoder;
70+
global.TextDecoder = TextDecoder;
71+
}
7072

7173
// Polyfill for crypto.randomUUID if needed
7274
if (!global.crypto) {

src/app/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@ngx-translate/http-loader": "8.0.0",
6161
"@project-sunbird/chatbot-client": "8.0.1",
6262
"@project-sunbird/ckeditor-build-classic": "4.1.3",
63-
"@project-sunbird/client-services": "8.1.0",
63+
"@project-sunbird/client-services": "8.1.4",
6464
"@project-sunbird/common-consumption": "8.0.2-v16",
6565
"@project-sunbird/common-form-elements-full": "8.0.6",
6666
"@project-sunbird/discussions-ui": "8.0.3-v16",
@@ -260,4 +260,4 @@
260260
"jest-preset-angular/build/serializers/html-comment"
261261
]
262262
}
263-
}
263+
}

src/app/helpers/whitelistApis.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,17 @@ const API_LIST = {
983983
'/action/dialcode/v3/search': {
984984
checksNeeded: ['ROLE_CHECK'],
985985
ROLE_CHECK: [
986-
ROLE.BOOK_CREATOR
986+
ROLE.BOOK_CREATOR,
987+
ROLE.COURSE_CREATOR,
988+
ROLE.CONTENT_CREATOR
987989
]
988990
},
989991
'/action/dialcode/v3/read/:dialId': {
990992
checksNeeded: ['ROLE_CHECK'],
991993
ROLE_CHECK: [
992-
ROLE.BOOK_CREATOR
994+
ROLE.BOOK_CREATOR,
995+
ROLE.COURSE_CREATOR,
996+
ROLE.CONTENT_CREATOR
993997
]
994998
},
995999
'/action/dialcode/v1/reserve/:do_id': {

0 commit comments

Comments
 (0)