-
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.
WIP | create tests post.body.params.transform-pipe
- Loading branch information
1 parent
6912a15
commit 6675d4c
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...server/src/modules/h5p-editor/controller/dto/ajax/post.body.params.transform-pipe.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,41 @@ | ||
import { AjaxPostBodyParams, LibrariesBodyParams, LibraryParametersBodyParams } from './post.body.params'; | ||
import { AjaxPostBodyParamsTransformPipe } from './post.body.params.transform-pipe'; | ||
|
||
describe('transform', () => { | ||
let ajaxBodyTransformPipe: AjaxPostBodyParamsTransformPipe; | ||
let emptyAjaxPostBodyParams1: AjaxPostBodyParams; | ||
// let emptyAjaxPostBodyParams2: AjaxPostBodyParams; | ||
let emptyAjaxPostBodyParams3: AjaxPostBodyParams; | ||
let emptyAjaxPostBodyParams4: AjaxPostBodyParams; | ||
|
||
beforeAll(() => { | ||
ajaxBodyTransformPipe = new AjaxPostBodyParamsTransformPipe(); | ||
|
||
const emptyLibrariesBodyParams: LibrariesBodyParams = { | ||
libraries: [], | ||
}; | ||
|
||
const emptyLibraryParametersBodyParams: LibraryParametersBodyParams = { | ||
libraryParameters: '', | ||
}; | ||
|
||
emptyAjaxPostBodyParams1 = emptyLibrariesBodyParams; | ||
emptyAjaxPostBodyParams3 = emptyLibraryParametersBodyParams; | ||
emptyAjaxPostBodyParams4 = undefined; | ||
}); | ||
|
||
it('when libaries in value', async () => { | ||
const result = await ajaxBodyTransformPipe.transform(emptyAjaxPostBodyParams1); | ||
expect(result).toBeDefined(); | ||
}); | ||
|
||
it('when libaryParameters in value', async () => { | ||
const result = await ajaxBodyTransformPipe.transform(emptyAjaxPostBodyParams3); | ||
expect(result).toBeDefined(); | ||
}); | ||
|
||
it('when not libaries | contentId | libaryParameters in value', async () => { | ||
const result = await ajaxBodyTransformPipe.transform(emptyAjaxPostBodyParams4); | ||
expect(result).toBeUndefined(); | ||
}); | ||
}); |
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