diff --git a/lib/base.spec.ts b/lib/base.spec.ts new file mode 100644 index 0000000..8f72bd2 --- /dev/null +++ b/lib/base.spec.ts @@ -0,0 +1,20 @@ +import BaseClass from './base'; + +describe('BaseClass', () => { + it('should be able to create BaseClass with options', () => { + const instance = new BaseClass({ + baselineFolder: './subfolder//../baseline', + screenshotPath: './../my_folder//screenshots' + }); + expect(instance.folders.actualFolder).toBe('../my_folder/screenshots/actual'); + expect(instance.folders.baselineFolder).toBe('baseline'); + expect(instance.folders.diffFolder).toBe('../my_folder/screenshots/diff'); + }); + + it('should be able to create BaseClass with default options', () => { + const instance = new BaseClass({}); + expect(instance.folders.actualFolder).toBe('.tmp/actual'); + expect(instance.folders.baselineFolder).toBe('wic/baseline/'); + expect(instance.folders.diffFolder).toBe('.tmp/diff'); + }); +}); diff --git a/lib/clientSideScripts/scrollToPosition.spec.ts b/lib/clientSideScripts/scrollToPosition.spec.ts index 89e3fdd..d439c5e 100644 --- a/lib/clientSideScripts/scrollToPosition.spec.ts +++ b/lib/clientSideScripts/scrollToPosition.spec.ts @@ -1,9 +1,9 @@ import scrollToPosition from './scrollToPosition'; -xdescribe('scrollToPosition', () => { +describe('scrollToPosition', () => { it('should check if the scrollTo function has been called', () => { + window.scrollTo = jest.fn(); scrollToPosition(150); - // I can't verify the call of the scrollToPosition with Jest, so there is no verification here, sorry :( - // If you know a way, please add it here ;-) + expect(window.scrollTo).toBeCalledWith(0, 150); }); });