Skip to content

Commit

Permalink
chore: add tests for demo-school-response
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeppner-dataport committed Sep 26, 2023
1 parent 6a79e83 commit 51e8d3b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { DemoSchoolResponse } from './demo-school.response';

describe(DemoSchoolResponse.name, () => {
describe('when creating a demo school response that only contains one root entry', () => {
it('should have basic properties defined', () => {
const data = { id: 'anId', type: 'school', key: 'my School', children: [] };
const response = new DemoSchoolResponse(data);
expect(response.type).toEqual(data.type);
expect(response.id).toEqual(data.id);
expect(response.key).toEqual(data.key);
expect(response.children).toEqual(data.children);
});

it('should map child entity information correctly', () => {
const data = {
id: 'anId',
type: 'school',
key: 'my School',
children: [{ id: 'anOtherId', type: 'user', key: '[email protected]', children: [] }],
};
const response = new DemoSchoolResponse(data);
expect(response.type).toEqual(data.type);
expect(response.id).toEqual(data.id);
expect(response.key).toEqual(data.key);
expect(response.children).toEqual(data.children);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ export class DemoSchoolResponse {
id: string | undefined;

@ApiPropertyOptional({
description: 'Title of the Board',
description: 'relevant identifier for the object (course.name, user.email, ...)',
})
key: string | undefined;

@ApiProperty({
description: 'Title of the Board',
description: 'type of the created entity',
})
type: string;

@ApiPropertyOptional({
description: 'Title of the Board',
description: 'child entities that were also created',
})
children: DemoSchoolResponse[] | undefined;
}

0 comments on commit 51e8d3b

Please sign in to comment.