Skip to content

Commit

Permalink
EW-1060 modified linked task of topic
Browse files Browse the repository at this point in the history
  • Loading branch information
Fshmit committed Dec 13, 2024
1 parent 01d36c3 commit 2d480a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LessonDto {

public materials: LessonMaterialsDto[];

public linkedTasks?: LessonLinkedTaskDto[];
public linkedTasks: LessonLinkedTaskDto[];

constructor(props: LessonDto) {
this.lessonId = props.lessonId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class LessonDtoMapper {
contents: lessonResponse.contents
.map((content) => this.mapToLessenContentDto(content))
.filter((contetnDto) => contetnDto !== null),
linkedTasks: [],
materials: lessonResponse.materials.map((material) => this.mapToLessonMaterialDto(material)),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('CommonCartridgeExportService', () => {
const { archive, lesson } = await setup();
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();

lesson.linkedTasks?.forEach((linkedTask) => {
lesson.linkedTasks.forEach((linkedTask) => {
expect(manifest).toContain(`<title>${linkedTask.name}</title>`);
});
});
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('CommonCartridgeExportService', () => {
const { archive, lesson } = await setup();
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();

lesson.linkedTasks?.forEach((linkedTask) => {
lesson.linkedTasks.forEach((linkedTask) => {
expect(manifest).toContain(`<title>${linkedTask.name}</title>`);
});
});
Expand Down Expand Up @@ -337,29 +337,5 @@ describe('CommonCartridgeExportService', () => {
);
});
});

describe('when topics has no linked tasks', () => {
const setup = async () => setupParams(CommonCartridgeVersion.V_1_1_0, false, true, true);

it('should add lesson without linked tasks', async () => {
const { archive, lesson } = await setup();
lesson.linkedTasks = undefined;

expect(getFileContent(archive, 'imsmanifest.xml')).not.toContain(createXmlString('title', lesson.name));
});
});

describe('when columnBoards has no cards', () => {
const setup = async () => setupParams(CommonCartridgeVersion.V_1_1_0, true, true, false);

it('should add column boards without cards', async () => {
const { archive, boardSkeleton } = await setup();
boardSkeleton.columns[0].cards = [];

expect(getFileContent(archive, 'imsmanifest.xml')).not.toContain(
createXmlString('title', boardSkeleton.columns[0].title)
);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class CommonCartridgeExportService {
this.addComponentToOrganization(content, lessonsOrganization);
});

lesson.linkedTasks?.forEach((task) => {
lesson.linkedTasks.forEach((task) => {
lessonsOrganization.addResource(this.mapper.mapLinkedTaskToResource(task, version));
});
});
Expand Down

0 comments on commit 2d480a2

Please sign in to comment.