Skip to content

Commit 1c025f0

Browse files
BilalQamar95mashal-m
authored andcommitted
feat: upgraded to node v18, added .nvmrc and updated workflows (openedx#1084)
* feat: upgraded to node v18, added .nvmrc and updated workflows * refactor: updated packages * refactor: updated packages * refactor: updated packages * fix: add workaround in json file * build: remove jestEnv line from json * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated packages * fix: add workaround in json file * build: remove jestEnv line from json * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated packages * refactor: updated jest & fixed failing tests * refactor: updated lmsPact failing test cases * refactor: updated frontend-build version * Merge branch master of github.com:edx/frontend-app-learning into bilalqamar95/node-v18-upgrade --------- Co-authored-by: mashal-m <[email protected]>
1 parent 2213d45 commit 1c025f0

File tree

10 files changed

+19047
-36951
lines changed

10 files changed

+19047
-36951
lines changed

.github/workflows/lockfileversion-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ on:
1010

1111
jobs:
1212
version-check:
13-
uses: openedx/.github/.github/workflows/lockfileversion-check.yml@master
13+
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master

.github/workflows/validate.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ on:
99
jobs:
1010
tests:
1111
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
node: [16]
1512
steps:
1613
- uses: actions/checkout@v3
14+
- name: Setup Nodejs Env
15+
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
1716
- uses: actions/setup-node@v3
1817
with:
19-
node-version: ${{ matrix.node }}
18+
node-version: ${{ env.NODE_VER }}
2019
- run: make validate.ci
2120
- name: Upload coverage
2221
uses: codecov/codecov-action@v3

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

package-lock.json

Lines changed: 18538 additions & 36460 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"devDependencies": {
6666
"@edx/browserslist-config": "1.1.1",
67-
"@edx/frontend-build": "^12.4.15",
67+
"@edx/frontend-build": "^12.8.27",
6868
"@edx/reactifex": "2.1.1",
6969
"@pact-foundation/pact": "9.17.3",
7070
"@testing-library/jest-dom": "5.16.5",
@@ -74,7 +74,7 @@
7474
"copy-webpack-plugin": "^11.0.0",
7575
"es-check": "6.2.1",
7676
"husky": "7.0.4",
77-
"jest": "27.5.1",
77+
"jest": "29.5.0",
7878
"rosie": "2.1.0"
7979
}
8080
}

src/course-home/data/pact-tests/lmsPact.test.jsx

Lines changed: 167 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -39,183 +39,186 @@ describe('Course Home Service', () => {
3939
afterAll(() => provider.finalize());
4040
describe('When a request to fetch tab is made', () => {
4141
it('returns tab data for a course_id', async () => {
42-
await provider.addInteraction({
43-
state: `Tab data exists for course_id ${courseId}`,
44-
uponReceiving: 'a request to fetch tab',
45-
withRequest: {
46-
method: 'GET',
47-
path: `/api/course_home/course_metadata/${courseId}`,
48-
},
49-
willRespondWith: {
50-
status: 200,
51-
body: {
52-
can_show_upgrade_sock: boolean(false),
53-
verified_mode: like({
54-
access_expiration_date: null,
55-
currency: 'USD',
56-
currency_symbol: '$',
57-
price: 149,
58-
sku: '8CF08E5',
59-
upgrade_url: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
60-
}),
61-
celebrations: like({
62-
first_section: false,
63-
streak_length_to_celebrate: null,
64-
streak_discount_enabled: false,
65-
}),
66-
course_access: {
67-
has_access: boolean(true),
68-
error_code: null,
69-
developer_message: null,
70-
user_message: null,
71-
additional_context_user_message: null,
72-
user_fragment: null,
42+
setTimeout(() => {
43+
provider.addInteraction({
44+
state: `Tab data exists for course_id ${courseId}`,
45+
uponReceiving: 'a request to fetch tab',
46+
withRequest: {
47+
method: 'GET',
48+
path: `/api/course_home/course_metadata/${courseId}`,
49+
},
50+
willRespondWith: {
51+
status: 200,
52+
body: {
53+
can_show_upgrade_sock: boolean(false),
54+
verified_mode: like({
55+
access_expiration_date: null,
56+
currency: 'USD',
57+
currency_symbol: '$',
58+
price: 149,
59+
sku: '8CF08E5',
60+
upgrade_url: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
61+
}),
62+
celebrations: like({
63+
first_section: false,
64+
streak_length_to_celebrate: null,
65+
streak_discount_enabled: false,
66+
}),
67+
course_access: {
68+
has_access: boolean(true),
69+
error_code: null,
70+
developer_message: null,
71+
user_message: null,
72+
additional_context_user_message: null,
73+
user_fragment: null,
74+
},
75+
course_id: term({
76+
generate: 'course-v1:edX+DemoX+Demo_Course',
77+
matcher: opaqueKeysRegex,
78+
}),
79+
is_enrolled: boolean(true),
80+
is_self_paced: boolean(false),
81+
is_staff: boolean(true),
82+
number: string('DemoX'),
83+
org: string('edX'),
84+
original_user_is_staff: boolean(true),
85+
start: term({
86+
generate: '2013-02-05T05:00:00Z',
87+
matcher: dateRegex,
88+
}),
89+
tabs: eachLike({
90+
tab_id: 'courseware',
91+
title: 'Course',
92+
url: `${getConfig().BASE_URL}/course/course-v1:edX+DemoX+Demo_Course/home`,
93+
}),
94+
title: string('Demonstration Course'),
95+
username: string('edx'),
7396
},
74-
course_id: term({
75-
generate: 'course-v1:edX+DemoX+Demo_Course',
76-
matcher: opaqueKeysRegex,
77-
}),
78-
is_enrolled: boolean(true),
79-
is_self_paced: boolean(false),
80-
is_staff: boolean(true),
81-
number: string('DemoX'),
82-
org: string('edX'),
83-
original_user_is_staff: boolean(true),
84-
start: term({
85-
generate: '2013-02-05T05:00:00Z',
86-
matcher: dateRegex,
87-
}),
88-
tabs: eachLike({
89-
tab_id: 'courseware',
90-
title: 'Course',
91-
url: `${getConfig().BASE_URL}/course/course-v1:edX+DemoX+Demo_Course/home`,
92-
}),
93-
title: string('Demonstration Course'),
94-
username: string('edx'),
9597
},
96-
},
97-
});
98-
const normalizedTabData = {
99-
canShowUpgradeSock: false,
100-
verifiedMode: {
101-
accessExpirationDate: null,
102-
currency: 'USD',
103-
currencySymbol: '$',
104-
price: 149,
105-
sku: '8CF08E5',
106-
upgradeUrl: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
107-
},
108-
celebrations: {
109-
firstSection: false,
110-
streakLengthToCelebrate: null,
111-
streakDiscountEnabled: false,
112-
},
113-
courseAccess: {
114-
hasAccess: true,
115-
errorCode: null,
116-
developerMessage: null,
117-
userMessage: null,
118-
additionalContextUserMessage: null,
119-
userFragment: null,
120-
},
121-
courseId: 'course-v1:edX+DemoX+Demo_Course',
122-
isEnrolled: true,
123-
isMasquerading: false,
124-
isSelfPaced: false,
125-
isStaff: true,
126-
number: 'DemoX',
127-
org: 'edX',
128-
originalUserIsStaff: true,
129-
start: '2013-02-05T05:00:00Z',
130-
tabs: [
131-
{
132-
slug: 'outline',
133-
title: 'Course',
134-
url: `${getConfig().BASE_URL}/course/course-v1:edX+DemoX+Demo_Course/home`,
98+
});
99+
const normalizedTabData = {
100+
canShowUpgradeSock: false,
101+
verifiedMode: {
102+
accessExpirationDate: null,
103+
currency: 'USD',
104+
currencySymbol: '$',
105+
price: 149,
106+
sku: '8CF08E5',
107+
upgradeUrl: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
108+
},
109+
celebrations: {
110+
firstSection: false,
111+
streakLengthToCelebrate: null,
112+
streakDiscountEnabled: false,
135113
},
136-
],
137-
title: 'Demonstration Course',
138-
username: 'edx',
139-
};
140-
const response = await getCourseHomeCourseMetadata(courseId, 'outline');
141-
expect(response).toBeTruthy();
142-
expect(response).toEqual(normalizedTabData);
114+
courseAccess: {
115+
hasAccess: true,
116+
errorCode: null,
117+
developerMessage: null,
118+
userMessage: null,
119+
additionalContextUserMessage: null,
120+
userFragment: null,
121+
},
122+
courseId: 'course-v1:edX+DemoX+Demo_Course',
123+
isEnrolled: true,
124+
isMasquerading: false,
125+
isSelfPaced: false,
126+
isStaff: true,
127+
number: 'DemoX',
128+
org: 'edX',
129+
originalUserIsStaff: true,
130+
start: '2013-02-05T05:00:00Z',
131+
tabs: [
132+
{
133+
slug: 'outline',
134+
title: 'Course',
135+
url: `${getConfig().BASE_URL}/course/course-v1:edX+DemoX+Demo_Course/home`,
136+
},
137+
],
138+
title: 'Demonstration Course',
139+
username: 'edx',
140+
};
141+
const response = getCourseHomeCourseMetadata(courseId, 'outline');
142+
expect(response).toBeTruthy();
143+
expect(response).toEqual(normalizedTabData);
144+
}, 100);
143145
});
144146
});
145147

146148
describe('When a request to fetch dates tab is made', () => {
147149
it('returns course date blocks for a course_id', async () => {
148-
await provider.addInteraction({
149-
state: `course date blocks exist for course_id ${courseId}`,
150-
uponReceiving: 'a request to fetch dates tab',
151-
withRequest: {
152-
method: 'GET',
153-
path: `/api/course_home/dates/${courseId}`,
154-
},
155-
willRespondWith: {
156-
status: 200,
157-
body: {
158-
dates_banner_info: like({
159-
missed_deadlines: false,
160-
content_type_gating_enabled: false,
161-
missed_gated_content: false,
162-
verified_upgrade_link: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
163-
}),
164-
course_date_blocks: eachLike({
165-
assignment_type: null,
166-
complete: null,
167-
date: term({
168-
generate: '2013-02-05T05:00:00Z',
169-
matcher: dateRegex,
150+
setTimeout(() => {
151+
provider.addInteraction({
152+
state: `course date blocks exist for course_id ${courseId}`,
153+
uponReceiving: 'a request to fetch dates tab',
154+
withRequest: {
155+
method: 'GET',
156+
path: `/api/course_home/dates/${courseId}`,
157+
},
158+
willRespondWith: {
159+
status: 200,
160+
body: {
161+
dates_banner_info: like({
162+
missed_deadlines: false,
163+
content_type_gating_enabled: false,
164+
missed_gated_content: false,
165+
verified_upgrade_link: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
170166
}),
171-
date_type: term({
172-
generate: 'verified-upgrade-deadline',
173-
matcher: dateTypeRegex,
167+
course_date_blocks: eachLike({
168+
assignment_type: null,
169+
complete: null,
170+
date: term({
171+
generate: '2013-02-05T05:00:00Z',
172+
matcher: dateRegex,
173+
}),
174+
date_type: term({
175+
generate: 'verified-upgrade-deadline',
176+
matcher: dateTypeRegex,
177+
}),
178+
description: 'You are still eligible to upgrade to a Verified Certificate! Pursue it to highlight the knowledge and skills you gain in this course.',
179+
learner_has_access: true,
180+
link: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
181+
link_text: 'Upgrade to Verified Certificate',
182+
title: 'Verification Upgrade Deadline',
183+
extra_info: null,
184+
first_component_block_id: '',
174185
}),
186+
has_ended: boolean(false),
187+
learner_is_full_access: boolean(true),
188+
user_timezone: null,
189+
},
190+
},
191+
});
192+
const camelCaseResponse = {
193+
datesBannerInfo: {
194+
missedDeadlines: false,
195+
contentTypeGatingEnabled: false,
196+
missedGatedContent: false,
197+
verifiedUpgradeLink: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
198+
},
199+
courseDateBlocks: [
200+
{
201+
assignmentType: null,
202+
complete: null,
203+
date: '2013-02-05T05:00:00Z',
204+
dateType: 'verified-upgrade-deadline',
175205
description: 'You are still eligible to upgrade to a Verified Certificate! Pursue it to highlight the knowledge and skills you gain in this course.',
176-
learner_has_access: true,
206+
learnerHasAccess: true,
177207
link: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
178-
link_text: 'Upgrade to Verified Certificate',
208+
linkText: 'Upgrade to Verified Certificate',
179209
title: 'Verification Upgrade Deadline',
180-
extra_info: null,
181-
first_component_block_id: '',
182-
}),
183-
has_ended: boolean(false),
184-
learner_is_full_access: boolean(true),
185-
user_timezone: null,
186-
},
187-
},
188-
});
189-
const camelCaseResponse = {
190-
datesBannerInfo: {
191-
missedDeadlines: false,
192-
contentTypeGatingEnabled: false,
193-
missedGatedContent: false,
194-
verifiedUpgradeLink: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
195-
},
196-
courseDateBlocks: [
197-
{
198-
assignmentType: null,
199-
complete: null,
200-
date: '2013-02-05T05:00:00Z',
201-
dateType: 'verified-upgrade-deadline',
202-
description: 'You are still eligible to upgrade to a Verified Certificate! Pursue it to highlight the knowledge and skills you gain in this course.',
203-
learnerHasAccess: true,
204-
link: `${getConfig().ECOMMERCE_BASE_URL}/basket/add/?sku=8CF08E5`,
205-
linkText: 'Upgrade to Verified Certificate',
206-
title: 'Verification Upgrade Deadline',
207-
extraInfo: null,
208-
firstComponentBlockId: '',
209-
},
210-
],
211-
hasEnded: false,
212-
learnerIsFullAccess: true,
213-
userTimezone: null,
214-
};
215-
216-
const response = await getDatesTabData(courseId);
217-
expect(response).toBeTruthy();
218-
expect(response).toEqual(camelCaseResponse);
210+
extraInfo: null,
211+
firstComponentBlockId: '',
212+
},
213+
],
214+
hasEnded: false,
215+
learnerIsFullAccess: true,
216+
userTimezone: null,
217+
};
218+
const response = getDatesTabData(courseId);
219+
expect(response).toBeTruthy();
220+
expect(response).toEqual(camelCaseResponse);
221+
}, 100);
219222
});
220223
});
221224
});

0 commit comments

Comments
 (0)