diff --git a/Frontend/package-lock.json b/Frontend/package-lock.json index 49952e39..b7e14b36 100644 --- a/Frontend/package-lock.json +++ b/Frontend/package-lock.json @@ -8539,6 +8539,19 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -14460,14 +14473,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/react-chatbot-kit/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/react-chatbot-kit/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -23550,6 +23555,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -27704,11 +27715,6 @@ "ajv-keywords": "^3.5.2" } }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/Frontend/src/benchi-chatbot/config.js b/Frontend/src/benchi-chatbot/config.js index 63d3dd93..1dd6e70a 100644 --- a/Frontend/src/benchi-chatbot/config.js +++ b/Frontend/src/benchi-chatbot/config.js @@ -12,7 +12,6 @@ const config = { state: { questionNr: 0, userPreferences: {experience: '', risk: '', active: false, effort: '', duration: ''}, - textToSpeech: new TextToSpeech() }, customComponents: { // Replaces the default header diff --git a/Frontend/src/components/screens/Analysis/__test__/AnalysisScreen.test.jsx b/Frontend/src/components/screens/Analysis/__test__/AnalysisScreen.test.jsx index 05d1c717..f327c036 100644 --- a/Frontend/src/components/screens/Analysis/__test__/AnalysisScreen.test.jsx +++ b/Frontend/src/components/screens/Analysis/__test__/AnalysisScreen.test.jsx @@ -8,6 +8,10 @@ import toJson from 'enzyme-to-json'; configure({adapter: new Adapter()}); +jest.mock('../../../../benchi-chatbot/TextToSpeech', () => ({ + ctx: {} +})); + it('AnalysisScreen renders without crashing', () => { const setSearchResult = jest.fn(); const setPortfolioData = jest.fn(); diff --git a/Frontend/src/components/screens/AssetDetails/__test__/AssetDetails.test.jsx b/Frontend/src/components/screens/AssetDetails/__test__/AssetDetails.test.jsx index b0ba5b11..ecedff77 100644 --- a/Frontend/src/components/screens/AssetDetails/__test__/AssetDetails.test.jsx +++ b/Frontend/src/components/screens/AssetDetails/__test__/AssetDetails.test.jsx @@ -6,6 +6,10 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; Enzyme.configure({adapter: new Adapter()}) +jest.mock('../../../../benchi-chatbot/TextToSpeech', () => ({ + ctx: {} +})); + it('AssetDetailsScreen renders without crashing', () => { const portfolioData = { 'Portfolio': { diff --git a/Frontend/src/components/screens/Dashboard/__test__/DashboardScreen.test.jsx b/Frontend/src/components/screens/Dashboard/__test__/DashboardScreen.test.jsx index b1c93b92..659e8948 100644 --- a/Frontend/src/components/screens/Dashboard/__test__/DashboardScreen.test.jsx +++ b/Frontend/src/components/screens/Dashboard/__test__/DashboardScreen.test.jsx @@ -3,9 +3,13 @@ import DashboardScreen from '../DashboardScreen'; import toJson from 'enzyme-to-json'; import Enzyme, {shallow} from 'enzyme'; import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; +import {BrowserRouter} from 'react-router-dom'; Enzyme.configure({adapter: new Adapter()}) +jest.mock('../../../../benchi-chatbot/TextToSpeech', () => ({ + ctx: {} +})); it('DashboardScreen renders without crashing', () => { const portfolioData = { @@ -29,8 +33,9 @@ it('DashboardScreen renders without crashing', () => { const getAllAssets = jest.fn(); const setStatusMessage = jest.fn(); const setMessageType = jest.fn(); + const addPortfolio = jest.fn(); - const wrapper = shallow( + const wrapper = shallow( { setPortfolioData={setPortfolioData} setStatusMessage={setStatusMessage} setMessageType={setMessageType} - />); + /> + ); expect(toJson(wrapper)).toMatchSnapshot(); }) \ No newline at end of file diff --git a/Frontend/src/components/screens/Dashboard/__test__/__snapshots__/DashboardScreen.test.jsx.snap b/Frontend/src/components/screens/Dashboard/__test__/__snapshots__/DashboardScreen.test.jsx.snap index a5d5ceea..6b5c5ec1 100644 --- a/Frontend/src/components/screens/Dashboard/__test__/__snapshots__/DashboardScreen.test.jsx.snap +++ b/Frontend/src/components/screens/Dashboard/__test__/__snapshots__/DashboardScreen.test.jsx.snap @@ -1,19 +1,69 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DashboardScreen renders without crashing 1`] = ` - - + - + `; diff --git a/Frontend/src/components/screens/Settings/__test__/SettingsScreen.test.jsx b/Frontend/src/components/screens/Settings/__test__/SettingsScreen.test.jsx index 92964aa9..e795f837 100644 --- a/Frontend/src/components/screens/Settings/__test__/SettingsScreen.test.jsx +++ b/Frontend/src/components/screens/Settings/__test__/SettingsScreen.test.jsx @@ -7,6 +7,10 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; Enzyme.configure({adapter: new Adapter()}) +jest.mock('../../../../benchi-chatbot/TextToSpeech', () => ({ + ctx: {} +})); + it('SettingsScreen renders without crashing', () => { const emptyPortfolioData = { 'Portfolio': { diff --git a/Frontend/src/components/screens/WatchLists/__test__/WatchListsScreen.test.jsx b/Frontend/src/components/screens/WatchLists/__test__/WatchListsScreen.test.jsx index 8df3abf4..002598ce 100644 --- a/Frontend/src/components/screens/WatchLists/__test__/WatchListsScreen.test.jsx +++ b/Frontend/src/components/screens/WatchLists/__test__/WatchListsScreen.test.jsx @@ -25,6 +25,10 @@ jest.mock('react-router-dom', () => ({ useNavigate: () => mockedNavigator })); +jest.mock('../../../../benchi-chatbot/TextToSpeech', () => ({ + ctx: {} +})); + describe('Tests regarding WatchList screen', () => { const addToWatchList = jest.fn(); const setWatchListsArray = jest.fn();