diff --git a/jest.config.js b/jest.config.js index 6cf339521a29b3096017066df033214ee39a3733..b6a027a5b05f2f8316ff6f26570db8a860f997be 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,6 +18,7 @@ module.exports = { globals: { __ALLOW_HTTP__: false, __TARGET__: 'browser', + __PIWIK_TRACKER_URL__: 'http://localhost:9800/', cozy: {}, }, } diff --git a/src/components/Options/MatomoOptOut.spec.tsx b/src/components/Options/MatomoOptOut.spec.tsx new file mode 100644 index 0000000000000000000000000000000000000000..11ca220012806d180ab8d95272e65ad1679325d2 --- /dev/null +++ b/src/components/Options/MatomoOptOut.spec.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import { shallow } from 'enzyme' +import { MatomoOptOut } from './MatomoOptOut' + +jest.mock('cozy-ui/transpiled/react/I18n', () => { + return { + useI18n: jest.fn(() => { + return { + t: (str: string) => str, + } + }), + } +}) + +describe('MatomoOptOut component', () => { + it('should be rendered correctly', () => { + const component = shallow(<MatomoOptOut />).getElement() + expect(component).toMatchSnapshot() + }) +}) diff --git a/src/components/Options/__snapshots__/MatomoOptOut.spec.tsx.snap b/src/components/Options/__snapshots__/MatomoOptOut.spec.tsx.snap new file mode 100644 index 0000000000000000000000000000000000000000..599b28c0a472fe9b02fd1b93dc448c2b6e597659 --- /dev/null +++ b/src/components/Options/__snapshots__/MatomoOptOut.spec.tsx.snap @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`MatomoOptOut component should be rendered correctly 1`] = ` +<div + className="matomo-opt-out-container" +> + <div + className="matomo-opt-out" + > + <div + className="opt-out-header text-16-normal-uppercase" + > + matomo.matomo_title + </div> + <iframe + src="http://localhost:9800/index.php?module=CoreAdminHome&action=optOut&language=fr&backgroundColor=121212&fontColor=e0e0e0&fontSize=&fontFamily=sans-serif" + style={ + Object { + "height": "250px", + } + } + /> + </div> +</div> +`;