Skip to content

Commit

Permalink
Merge branch 'THR-18-dev-feature-h5p-editor' of https://github.com/hp…
Browse files Browse the repository at this point in the history
…i-schul-cloud/schulcloud-server into THR-18-dev-feature-h5p-editor
  • Loading branch information
MajedAlaitwniCap committed Nov 2, 2023
2 parents 276feae + da8e01f commit e9f6f4b
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ObjectId } from '@mikro-orm/mongodb';
import { ContentMetadata, H5PContent, H5PContentParentType, IH5PContentProperties } from './h5p-content.entity';

describe('H5PContent class', () => {
describe('when an H5PContent instance is created', () => {
const setup = () => {
const dummyIH5PContentProperties: IH5PContentProperties = {
creatorId: '507f1f77bcf86cd799439011',
parentType: H5PContentParentType.Lesson,
parentId: '507f1f77bcf86cd799439012',
schoolId: '507f1f77bcf86cd799439013',
metadata: new ContentMetadata({
embedTypes: ['iframe'],
language: 'en',
mainLibrary: 'mainLibrary123',
defaultLanguage: 'en',
license: 'MIT',
title: 'Title Example',
preloadedDependencies: [],
dynamicDependencies: [],
editorDependencies: [],
}),
content: {},
};

const h5pContent = new H5PContent(dummyIH5PContentProperties);
return { h5pContent, dummyIH5PContentProperties };
};

it('should correctly return the creatorId', () => {
const { h5pContent, dummyIH5PContentProperties } = setup();
const expectedCreatorId = new ObjectId(dummyIH5PContentProperties.creatorId).toHexString();
expect(h5pContent.creatorId).toBe(expectedCreatorId);
});

it('should correctly return the schoolId', () => {
const { h5pContent, dummyIH5PContentProperties } = setup();
const expectedSchoolId = new ObjectId(dummyIH5PContentProperties.schoolId).toHexString();
expect(h5pContent.schoolId).toBe(expectedSchoolId);
});
});
});

0 comments on commit e9f6f4b

Please sign in to comment.