-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add tests for demo-school-response
- Loading branch information
1 parent
6a79e83
commit 51e8d3b
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
apps/server/src/modules/demo/controller/dto/demo-school.response.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters