Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c442073eae
commit
59efc24077
|
@ -24,17 +24,30 @@ describe('Salix', () => {
|
|||
});
|
||||
|
||||
describe('viewportSelection()', () => {
|
||||
it('should call to displayEditor() and updatePhotoPreview() methods', () => {
|
||||
controller.displayEditor = jest.fn();
|
||||
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "computer"', () => {
|
||||
controller.updatePhotoPreview = jest.fn();
|
||||
|
||||
const files = [{name: 'test.jpg'}];
|
||||
controller.newPhoto.files = files;
|
||||
|
||||
controller.uploadMethod = 'computer';
|
||||
controller.viewportSelection = {code: 'normal'};
|
||||
|
||||
expect(controller.displayEditor).toHaveBeenCalledWith();
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(files);
|
||||
const firstFile = files[0];
|
||||
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(firstFile);
|
||||
});
|
||||
|
||||
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "URL"', () => {
|
||||
controller.updatePhotoPreview = jest.fn();
|
||||
|
||||
const url = 'http://gothamcity.com/batman.png';
|
||||
controller.newPhoto.url = url;
|
||||
|
||||
controller.uploadMethod = 'URL';
|
||||
controller.viewportSelection = {code: 'normal'};
|
||||
|
||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(url);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue