richie-education 2.34.1-dev2 → 2.34.1-dev22
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/js/components/ContractFrame/AbstractContractFrame.spec.tsx +3 -5
- package/js/components/Icon/index.tsx +2 -0
- package/js/hooks/useCreditCards/index.spec.tsx +3 -2
- package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx +1 -1
- package/js/types/index.ts +5 -0
- package/js/utils/test/factories/richie.ts +25 -0
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/EnrollableCourseRunList.tsx +2 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx +6 -4
- package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRun/index.tsx +107 -0
- package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRunCompacted/index.tsx +107 -0
- package/js/widgets/SyllabusCourseRunsList/index.spec.tsx +450 -5
- package/package.json +59 -59
- package/scss/colors/_theme.scss +10 -0
- package/scss/components/_header.scss +103 -14
- package/scss/components/_styleguide.scss +2 -1
- package/scss/components/templates/courses/cms/_program_detail.scss +71 -0
- package/scss/objects/_selector.scss +1 -0
- package/scss/settings/_variables.scss +2 -0
|
@@ -30,6 +30,8 @@ import { computeStates } from 'utils/CourseRuns';
|
|
|
30
30
|
import { IntlHelper } from 'utils/IntlHelper';
|
|
31
31
|
import { render } from 'utils/test/render';
|
|
32
32
|
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
33
|
+
import { SyllabusCourseRunCompacted } from './components/SyllabusCourseRunCompacted';
|
|
34
|
+
import { SyllabusCourseRun } from './components/SyllabusCourseRun';
|
|
33
35
|
|
|
34
36
|
jest.mock('utils/context', () => {
|
|
35
37
|
const mock = mockRichieContextFactory().one();
|
|
@@ -127,7 +129,6 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
127
129
|
const languagesContainer = languagesNode.nextSibling! as HTMLElement;
|
|
128
130
|
getByText(languagesContainer, IntlHelper.getLocalizedLanguages(courseRun.languages, intl));
|
|
129
131
|
|
|
130
|
-
expect(languagesContainer.nextSibling).toBeNull();
|
|
131
132
|
getByRole(runContainer, 'link', {
|
|
132
133
|
name: StringHelper.capitalizeFirst(courseRun.state.call_to_action)!,
|
|
133
134
|
});
|
|
@@ -568,7 +569,7 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
568
569
|
|
|
569
570
|
const portalContainer = getPortalContainer();
|
|
570
571
|
|
|
571
|
-
// Expect that
|
|
572
|
+
// Expect that 'is-hidden' class is set only to course runs in (MAX_ARCHIVED_COURSE_RUNS)nth-plus position.
|
|
572
573
|
expect(portalContainer.querySelectorAll('li').length).toBe(MAX_ARCHIVED_COURSE_RUNS * 2);
|
|
573
574
|
portalContainer.querySelectorAll('li').forEach((listElement, i) => {
|
|
574
575
|
expectCourseRunInList(listElement, courseRuns[i]);
|
|
@@ -585,7 +586,7 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
585
586
|
// click on view more.
|
|
586
587
|
await act(async () => user.click(button));
|
|
587
588
|
|
|
588
|
-
// expect that
|
|
589
|
+
// expect that 'is-hidden' are removed.
|
|
589
590
|
portalContainer.querySelectorAll('li').forEach((listElement, i) => {
|
|
590
591
|
expectCourseRunInList(listElement, courseRuns[i]);
|
|
591
592
|
expect(listElement.classList).not.toContain('is-hidden');
|
|
@@ -615,7 +616,7 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
615
616
|
const portalContainer = getPortalContainer();
|
|
616
617
|
expect(screen.queryByRole('button', { name: 'View more' })).not.toBeInTheDocument();
|
|
617
618
|
|
|
618
|
-
// expect that
|
|
619
|
+
// expect that 'is-hidden' is not set.
|
|
619
620
|
expect(portalContainer.querySelectorAll('li').length).toBe(MAX_ARCHIVED_COURSE_RUNS - 1);
|
|
620
621
|
portalContainer.querySelectorAll('li').forEach((listElement, i) => {
|
|
621
622
|
expectCourseRunInList(listElement, courseRuns[i]);
|
|
@@ -1009,7 +1010,7 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
1009
1010
|
const listElements = screen.getAllByRole('listitem');
|
|
1010
1011
|
expect(listElements.length).toBe(4);
|
|
1011
1012
|
|
|
1012
|
-
// Assert there is only one link, one label
|
|
1013
|
+
// Assert there is only one link, one label 'Enrolled' and one request to retrieve enrollment.
|
|
1013
1014
|
expect(await screen.findAllByText('Enrolled')).toHaveLength(1);
|
|
1014
1015
|
|
|
1015
1016
|
const links = screen.getAllByRole('link');
|
|
@@ -1024,4 +1025,448 @@ describe('<SyllabusCourseRunsList/>', () => {
|
|
|
1024
1025
|
`https://demo.endpoint/api/enrollment/v1/enrollment/${user.username},${onGoingCourseRun.resource_link}`,
|
|
1025
1026
|
);
|
|
1026
1027
|
});
|
|
1028
|
+
|
|
1029
|
+
it('renders price information as paid and paid on SyllabusCourseRunCompacted', async () => {
|
|
1030
|
+
const course = PacedCourseFactory().one();
|
|
1031
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1032
|
+
languages: ['en'],
|
|
1033
|
+
offer: 'paid',
|
|
1034
|
+
certificate_offer: 'paid',
|
|
1035
|
+
price_currency: 'EUR',
|
|
1036
|
+
price: 49.99,
|
|
1037
|
+
certificate_price: 59.99,
|
|
1038
|
+
}).one();
|
|
1039
|
+
|
|
1040
|
+
render(
|
|
1041
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1042
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1043
|
+
</div>,
|
|
1044
|
+
);
|
|
1045
|
+
|
|
1046
|
+
const content = getHeaderContainer().innerHTML;
|
|
1047
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1048
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
it('renders price information as subscription on SyllabusCourseRunCompacted', async () => {
|
|
1052
|
+
const course = PacedCourseFactory().one();
|
|
1053
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1054
|
+
languages: ['en'],
|
|
1055
|
+
offer: 'Subscription',
|
|
1056
|
+
certificate_offer: 'Subscription',
|
|
1057
|
+
price_currency: 'EUR',
|
|
1058
|
+
price: 49.99,
|
|
1059
|
+
certificate_price: 59.99,
|
|
1060
|
+
}).one();
|
|
1061
|
+
|
|
1062
|
+
render(
|
|
1063
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1064
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1065
|
+
</div>,
|
|
1066
|
+
);
|
|
1067
|
+
|
|
1068
|
+
const content = getHeaderContainer().innerHTML;
|
|
1069
|
+
expect(content).toContain('<dd>Subscribe to access the course content.<br>€49.99</dd>');
|
|
1070
|
+
expect(content).toContain(
|
|
1071
|
+
'<dd>The certification process is offered through subscription.<br>€59.99</dd>',
|
|
1072
|
+
);
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
it('renders price information as Partially free on SyllabusCourseRunCompacted', async () => {
|
|
1076
|
+
const course = PacedCourseFactory().one();
|
|
1077
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1078
|
+
languages: ['en'],
|
|
1079
|
+
offer: 'Partially free',
|
|
1080
|
+
certificate_offer: 'paid',
|
|
1081
|
+
price_currency: 'EUR',
|
|
1082
|
+
price: 0,
|
|
1083
|
+
certificate_price: 59.99,
|
|
1084
|
+
}).one();
|
|
1085
|
+
|
|
1086
|
+
render(
|
|
1087
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1088
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1089
|
+
</div>,
|
|
1090
|
+
);
|
|
1091
|
+
|
|
1092
|
+
const content = getHeaderContainer().innerHTML;
|
|
1093
|
+
expect(content).toContain('<dd>The course content is free.<br>€0.00</dd>');
|
|
1094
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
it('renders price information as paid and free on SyllabusCourseRunCompacted', async () => {
|
|
1098
|
+
const course = PacedCourseFactory().one();
|
|
1099
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1100
|
+
languages: ['en'],
|
|
1101
|
+
offer: 'paid',
|
|
1102
|
+
certificate_offer: 'free',
|
|
1103
|
+
price_currency: 'EUR',
|
|
1104
|
+
price: 49.99,
|
|
1105
|
+
certificate_price: 0,
|
|
1106
|
+
}).one();
|
|
1107
|
+
|
|
1108
|
+
render(
|
|
1109
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1110
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1111
|
+
</div>,
|
|
1112
|
+
);
|
|
1113
|
+
|
|
1114
|
+
const content = getHeaderContainer().innerHTML;
|
|
1115
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1116
|
+
expect(content).toContain('<dd>The certification process is free.<br>€0.00</dd>');
|
|
1117
|
+
});
|
|
1118
|
+
|
|
1119
|
+
it('does not render price information on SyllabusCourseRunCompacted', async () => {
|
|
1120
|
+
const course = PacedCourseFactory().one();
|
|
1121
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1122
|
+
languages: ['en'],
|
|
1123
|
+
offer: undefined,
|
|
1124
|
+
certificate_offer: undefined,
|
|
1125
|
+
price: 59.99,
|
|
1126
|
+
certificate_price: 59.99,
|
|
1127
|
+
}).one();
|
|
1128
|
+
|
|
1129
|
+
render(
|
|
1130
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1131
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1132
|
+
</div>,
|
|
1133
|
+
);
|
|
1134
|
+
|
|
1135
|
+
const content = getHeaderContainer().innerHTML;
|
|
1136
|
+
expect(content).not.toContain('The course content is paid');
|
|
1137
|
+
expect(content).not.toContain('The certification process is paid.');
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
it('does not render course price information on SyllabusCourseRunCompacted', async () => {
|
|
1141
|
+
const course = PacedCourseFactory().one();
|
|
1142
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1143
|
+
languages: ['en'],
|
|
1144
|
+
certificate_offer: 'paid',
|
|
1145
|
+
price_currency: 'EUR',
|
|
1146
|
+
offer: undefined,
|
|
1147
|
+
price: 59.99,
|
|
1148
|
+
certificate_price: 59.99,
|
|
1149
|
+
}).one();
|
|
1150
|
+
|
|
1151
|
+
render(
|
|
1152
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1153
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1154
|
+
</div>,
|
|
1155
|
+
);
|
|
1156
|
+
|
|
1157
|
+
const content = getHeaderContainer().innerHTML;
|
|
1158
|
+
expect(content).not.toContain('The course content is paid.');
|
|
1159
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1160
|
+
});
|
|
1161
|
+
|
|
1162
|
+
it('does not render certificate price information on SyllabusCourseRunCompacted', async () => {
|
|
1163
|
+
const course = PacedCourseFactory().one();
|
|
1164
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1165
|
+
languages: ['en'],
|
|
1166
|
+
price_currency: 'EUR',
|
|
1167
|
+
offer: 'paid',
|
|
1168
|
+
price: 49.99,
|
|
1169
|
+
certificate_offer: undefined,
|
|
1170
|
+
certificate_price: undefined,
|
|
1171
|
+
}).one();
|
|
1172
|
+
|
|
1173
|
+
render(
|
|
1174
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1175
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1176
|
+
</div>,
|
|
1177
|
+
);
|
|
1178
|
+
|
|
1179
|
+
const content = getHeaderContainer().innerHTML;
|
|
1180
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1181
|
+
expect(content).not.toContain('The certification process is paid.');
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
it('does not render prices but only offers on SyllabusCourseRunCompacted', async () => {
|
|
1185
|
+
const course = PacedCourseFactory().one();
|
|
1186
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1187
|
+
languages: ['en'],
|
|
1188
|
+
offer: 'free',
|
|
1189
|
+
certificate_offer: 'free',
|
|
1190
|
+
price_currency: 'EUR',
|
|
1191
|
+
price: undefined,
|
|
1192
|
+
certificate_price: undefined,
|
|
1193
|
+
}).one();
|
|
1194
|
+
|
|
1195
|
+
render(
|
|
1196
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1197
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1198
|
+
</div>,
|
|
1199
|
+
);
|
|
1200
|
+
|
|
1201
|
+
const content = getHeaderContainer().innerHTML;
|
|
1202
|
+
expect(content).toContain('<dd>The course content is free.<br></dd>');
|
|
1203
|
+
expect(content).toContain('<dd>The certification process is free.<br></dd>');
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
it('renders prices as zero on SyllabusCourseRunCompacted', async () => {
|
|
1207
|
+
const course = PacedCourseFactory().one();
|
|
1208
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1209
|
+
languages: ['en'],
|
|
1210
|
+
offer: 'free',
|
|
1211
|
+
certificate_offer: 'free',
|
|
1212
|
+
price_currency: 'EUR',
|
|
1213
|
+
price: 0,
|
|
1214
|
+
certificate_price: 0,
|
|
1215
|
+
}).one();
|
|
1216
|
+
|
|
1217
|
+
render(
|
|
1218
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1219
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1220
|
+
</div>,
|
|
1221
|
+
);
|
|
1222
|
+
|
|
1223
|
+
const content = getHeaderContainer().innerHTML;
|
|
1224
|
+
expect(content).toContain('<dd>The course content is free.<br>€0.00</dd>');
|
|
1225
|
+
expect(content).toContain('<dd>The certification process is free.<br>€0.00</dd>');
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
it('does not render invalid offers on SyllabusCourseRunCompacted', async () => {
|
|
1229
|
+
const course = PacedCourseFactory().one();
|
|
1230
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1231
|
+
languages: ['en'],
|
|
1232
|
+
offer: 'invalid',
|
|
1233
|
+
certificate_offer: 'invalid',
|
|
1234
|
+
price_currency: 'EUR',
|
|
1235
|
+
price: 59.99,
|
|
1236
|
+
certificate_price: 59.99,
|
|
1237
|
+
}).one();
|
|
1238
|
+
|
|
1239
|
+
render(
|
|
1240
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1241
|
+
<SyllabusCourseRunCompacted courseRun={courseRun} course={course} showLanguages={false} />
|
|
1242
|
+
</div>,
|
|
1243
|
+
);
|
|
1244
|
+
|
|
1245
|
+
const content = getHeaderContainer().innerHTML;
|
|
1246
|
+
expect(content).not.toContain('The course content is');
|
|
1247
|
+
expect(content).not.toContain('The certification process is');
|
|
1248
|
+
expect(content).not.toContain('<br>€59.99');
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
it('renders price information as paid and paid on SyllabusCourseRun', async () => {
|
|
1252
|
+
const course = PacedCourseFactory().one();
|
|
1253
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1254
|
+
languages: ['en'],
|
|
1255
|
+
offer: 'paid',
|
|
1256
|
+
certificate_offer: 'paid',
|
|
1257
|
+
price_currency: 'EUR',
|
|
1258
|
+
price: 49.99,
|
|
1259
|
+
certificate_price: 59.99,
|
|
1260
|
+
}).one();
|
|
1261
|
+
|
|
1262
|
+
render(
|
|
1263
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1264
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1265
|
+
</div>,
|
|
1266
|
+
);
|
|
1267
|
+
|
|
1268
|
+
const content = getHeaderContainer().innerHTML;
|
|
1269
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1270
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
it('renders price information as subscription on SyllabusCourseRun', async () => {
|
|
1274
|
+
const course = PacedCourseFactory().one();
|
|
1275
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1276
|
+
languages: ['en'],
|
|
1277
|
+
offer: 'Subscription',
|
|
1278
|
+
certificate_offer: 'Subscription',
|
|
1279
|
+
price_currency: 'EUR',
|
|
1280
|
+
price: 49.99,
|
|
1281
|
+
certificate_price: 59.99,
|
|
1282
|
+
}).one();
|
|
1283
|
+
|
|
1284
|
+
render(
|
|
1285
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1286
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1287
|
+
</div>,
|
|
1288
|
+
);
|
|
1289
|
+
|
|
1290
|
+
const content = getHeaderContainer().innerHTML;
|
|
1291
|
+
expect(content).toContain('<dd>Subscribe to access the course content.<br>€49.99</dd>');
|
|
1292
|
+
expect(content).toContain(
|
|
1293
|
+
'<dd>The certification process is offered through subscription.<br>€59.99</dd>',
|
|
1294
|
+
);
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
it('renders price information as Partially free on SyllabusCourseRun', async () => {
|
|
1298
|
+
const course = PacedCourseFactory().one();
|
|
1299
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1300
|
+
languages: ['en'],
|
|
1301
|
+
offer: 'Partially free',
|
|
1302
|
+
certificate_offer: 'paid',
|
|
1303
|
+
price_currency: 'EUR',
|
|
1304
|
+
price: 0,
|
|
1305
|
+
certificate_price: 59.99,
|
|
1306
|
+
}).one();
|
|
1307
|
+
|
|
1308
|
+
render(
|
|
1309
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1310
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1311
|
+
</div>,
|
|
1312
|
+
);
|
|
1313
|
+
|
|
1314
|
+
const content = getHeaderContainer().innerHTML;
|
|
1315
|
+
expect(content).toContain('<dd>The course content is free.<br>€0.00</dd>');
|
|
1316
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1317
|
+
});
|
|
1318
|
+
|
|
1319
|
+
it('renders price information as paid and free on SyllabusCourseRun', async () => {
|
|
1320
|
+
const course = PacedCourseFactory().one();
|
|
1321
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1322
|
+
languages: ['en'],
|
|
1323
|
+
offer: 'paid',
|
|
1324
|
+
certificate_offer: 'free',
|
|
1325
|
+
price_currency: 'EUR',
|
|
1326
|
+
price: 49.99,
|
|
1327
|
+
certificate_price: 0,
|
|
1328
|
+
}).one();
|
|
1329
|
+
|
|
1330
|
+
render(
|
|
1331
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1332
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1333
|
+
</div>,
|
|
1334
|
+
);
|
|
1335
|
+
|
|
1336
|
+
const content = getHeaderContainer().innerHTML;
|
|
1337
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1338
|
+
expect(content).toContain('<dd>The certification process is free.<br>€0.00</dd>');
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
it('does not render price information on SyllabusCourseRun', async () => {
|
|
1342
|
+
const course = PacedCourseFactory().one();
|
|
1343
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1344
|
+
languages: ['en'],
|
|
1345
|
+
offer: undefined,
|
|
1346
|
+
certificate_offer: undefined,
|
|
1347
|
+
price: 59.99,
|
|
1348
|
+
certificate_price: 59.99,
|
|
1349
|
+
}).one();
|
|
1350
|
+
|
|
1351
|
+
render(
|
|
1352
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1353
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1354
|
+
</div>,
|
|
1355
|
+
);
|
|
1356
|
+
|
|
1357
|
+
const content = getHeaderContainer().innerHTML;
|
|
1358
|
+
expect(content).not.toContain('The course content is paid');
|
|
1359
|
+
expect(content).not.toContain('The certification process is paid.');
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
it('does not render course price information on SyllabusCourseRun', async () => {
|
|
1363
|
+
const course = PacedCourseFactory().one();
|
|
1364
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1365
|
+
languages: ['en'],
|
|
1366
|
+
offer: undefined,
|
|
1367
|
+
price: 59.99,
|
|
1368
|
+
price_currency: 'EUR',
|
|
1369
|
+
certificate_offer: 'paid',
|
|
1370
|
+
certificate_price: 59.99,
|
|
1371
|
+
}).one();
|
|
1372
|
+
|
|
1373
|
+
render(
|
|
1374
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1375
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1376
|
+
</div>,
|
|
1377
|
+
);
|
|
1378
|
+
|
|
1379
|
+
const content = getHeaderContainer().innerHTML;
|
|
1380
|
+
expect(content).not.toContain('The course content is paid.');
|
|
1381
|
+
expect(content).toContain('<dd>The certification process is paid.<br>€59.99</dd>');
|
|
1382
|
+
});
|
|
1383
|
+
|
|
1384
|
+
it('does not render certificate price information on SyllabusCourseRun', async () => {
|
|
1385
|
+
const course = PacedCourseFactory().one();
|
|
1386
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1387
|
+
languages: ['en'],
|
|
1388
|
+
price_currency: 'EUR',
|
|
1389
|
+
offer: 'paid',
|
|
1390
|
+
price: 49.99,
|
|
1391
|
+
certificate_offer: undefined,
|
|
1392
|
+
certificate_price: undefined,
|
|
1393
|
+
}).one();
|
|
1394
|
+
|
|
1395
|
+
render(
|
|
1396
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1397
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1398
|
+
</div>,
|
|
1399
|
+
);
|
|
1400
|
+
|
|
1401
|
+
const content = getHeaderContainer().innerHTML;
|
|
1402
|
+
expect(content).toContain('<dd>The course content is paid.<br>€49.99</dd>');
|
|
1403
|
+
expect(content).not.toContain('The certification process is paid.');
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
it('does not render prices but only offers on SyllabusCourseRun', async () => {
|
|
1407
|
+
const course = PacedCourseFactory().one();
|
|
1408
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1409
|
+
languages: ['en'],
|
|
1410
|
+
offer: 'free',
|
|
1411
|
+
certificate_offer: 'free',
|
|
1412
|
+
price_currency: 'EUR',
|
|
1413
|
+
price: undefined,
|
|
1414
|
+
certificate_price: undefined,
|
|
1415
|
+
}).one();
|
|
1416
|
+
|
|
1417
|
+
render(
|
|
1418
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1419
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1420
|
+
</div>,
|
|
1421
|
+
);
|
|
1422
|
+
|
|
1423
|
+
const content = getHeaderContainer().innerHTML;
|
|
1424
|
+
expect(content).toContain('<dd>The course content is free.<br></dd>');
|
|
1425
|
+
expect(content).toContain('<dd>The certification process is free.<br></dd>');
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
it('renders prices as zero on SyllabusCourseRun', async () => {
|
|
1429
|
+
const course = PacedCourseFactory().one();
|
|
1430
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1431
|
+
languages: ['en'],
|
|
1432
|
+
offer: 'free',
|
|
1433
|
+
certificate_offer: 'free',
|
|
1434
|
+
price_currency: 'EUR',
|
|
1435
|
+
price: 0,
|
|
1436
|
+
certificate_price: 0,
|
|
1437
|
+
}).one();
|
|
1438
|
+
|
|
1439
|
+
render(
|
|
1440
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1441
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1442
|
+
</div>,
|
|
1443
|
+
);
|
|
1444
|
+
|
|
1445
|
+
const content = getHeaderContainer().innerHTML;
|
|
1446
|
+
expect(content).toContain('<dd>The course content is free.<br>€0.00</dd>');
|
|
1447
|
+
expect(content).toContain('<dd>The certification process is free.<br>€0.00</dd>');
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
it('does not render invalid offers on SyllabusCourseRun', async () => {
|
|
1451
|
+
const course = PacedCourseFactory().one();
|
|
1452
|
+
const courseRun: CourseRun = CourseRunFactoryFromPriority(Priority.ONGOING_OPEN)({
|
|
1453
|
+
languages: ['en'],
|
|
1454
|
+
offer: 'invalid',
|
|
1455
|
+
certificate_offer: 'invalid',
|
|
1456
|
+
price_currency: 'EUR',
|
|
1457
|
+
price: 59.99,
|
|
1458
|
+
certificate_price: 59.99,
|
|
1459
|
+
}).one();
|
|
1460
|
+
|
|
1461
|
+
render(
|
|
1462
|
+
<div className="course-detail__row course-detail__runs course-detail__runs--open">
|
|
1463
|
+
<SyllabusCourseRun courseRun={courseRun} course={course} showLanguages={false} />
|
|
1464
|
+
</div>,
|
|
1465
|
+
);
|
|
1466
|
+
|
|
1467
|
+
const content = getHeaderContainer().innerHTML;
|
|
1468
|
+
expect(content).not.toContain('The course content is');
|
|
1469
|
+
expect(content).not.toContain('The certification process is');
|
|
1470
|
+
expect(content).not.toContain('<br>€59.99');
|
|
1471
|
+
});
|
|
1027
1472
|
});
|