Skip to content

Commit

Permalink
EW-359 expanding the CC export to include topics and associated tasks (
Browse files Browse the repository at this point in the history
…#4594)

EW-359 expanded the CC export on tasks from topics
  • Loading branch information
Fshmit authored and bergatco committed Dec 6, 2023
1 parent dc47095 commit 5ab2879
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ describe('CommonCartridgeExportService', () => {
{} as ComponentProperties,
],
});
tasks = taskFactory.buildListWithId(5);
tasks = taskFactory.buildListWithId(5, {
name: 'Task of a lesson',
lesson: lessons[0],
});
});

afterAll(async () => {
Expand Down Expand Up @@ -148,6 +151,14 @@ describe('CommonCartridgeExportService', () => {
});
});

it('should add tasks of lesson to manifest file', () => {
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();
lessons[0].tasks.getItems().forEach((task) => {
expect(manifest).toContain(`<title>${task.name}</title>`);
expect(manifest).toContain(`identifier="i${task.id}" type="webcontent" intendeduse="unspecified"`);
});
});

it('should add version 1 information to manifest file', () => {
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();
expect(manifest).toContain(CommonCartridgeVersion.V_1_1_0);
Expand Down Expand Up @@ -198,6 +209,14 @@ describe('CommonCartridgeExportService', () => {
});
});

it('should add tasks of lesson to manifest file', () => {
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();
lessons[0].tasks.getItems().forEach((task) => {
expect(manifest).toContain(`<title>${task.name}</title>`);
expect(manifest).toContain(`identifier="i${task.id}" type="webcontent" intendeduse="assignment"`);
});
});

it('should add version 3 information to manifest file', () => {
const manifest = archive.getEntry('imsmanifest.xml')?.getData().toString();
expect(manifest).toContain(CommonCartridgeVersion.V_1_3_0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export class CommonCartridgeExportService {
organizationBuilder.addResourceToOrganization(resourceProps);
}
});

const tasks = lesson.tasks.getItems();
tasks.forEach((task) => {
organizationBuilder.addResourceToOrganization(this.mapTaskToWebContentResource(task, version));
});
});
}

Expand Down

0 comments on commit 5ab2879

Please sign in to comment.