Skip to content

Commit

Permalink
code snapshot v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-vladimirov committed Jun 27, 2023
1 parent 7c04a9b commit 8ce257c
Show file tree
Hide file tree
Showing 637 changed files with 81,698 additions and 14,957 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-unused-expressions": "off",
"jest/no-mocks-import": "off",
"jest/no-conditional-expect": "off"
"jest/no-conditional-expect": "off",
"no-continue": "off"
},
"overrides": [
{
Expand Down
26 changes: 22 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,37 @@ module.exports = {
'node_modules/(react-dnd|dnd-core|@react-dnd|react-dnd-html5-backend)/.+\\.(j|t)sx?$':
'ts-jest',
},
transformIgnorePatterns: ['/node_modules/(?!react-dnd|dnd-core|@react-dnd)'],
transformIgnorePatterns: ['/node_modules/(?!react-dnd|dnd-core|@react-dnd|antlr4)'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.svg': '<rootDir>/src/__mocks__/svg.ts',
'^src(.*)$': '<rootDir>/src$1',
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
antlr4: '<rootDir>/node_modules/antlr4/dist/antlr4.web.js',
},
resetMocks: false,
setupFiles: ['jest-localstorage-mock'],
setupFilesAfterEnv: ['jest-extended/all'],
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.stories.{ts,tsx}'],
testTimeout: 60000,
setupFilesAfterEnv: [
'jest-extended/all',
'<rootDir>/src/__mocks__/setupCreateObjectUrlMock.ts',
'<rootDir>/src/__mocks__/setUpDateMock.ts',
'<rootDir>/src/__mocks__/setupGetComputedTextLengthMock.ts',
'<rootDir>/src/__mocks__/setupRangeMock.ts',
'<rootDir>/src/__mocks__/setupResizeObserverMock.ts',
'<rootDir>/src/__mocks__/setupResponsiveContainerMock.ts',
'<rootDir>/src/__mocks__/setupScrollIntoViewMock.ts',
'<rootDir>/src/__mocks__/setUpTextDecoderMock.ts',
'<rootDir>/src/__mocks__/setupUniqueIdMock.ts',
'<rootDir>/src/__mocks__/setupWindowMatchMediaMock.ts',
],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.stories.{ts,tsx}',
// generated files from antlr
'!src/modules/study-management/user-management/task-management/survey/survey-editor/antlr/*.ts',
],
testTimeout: 120000,
reporters: [
'default',
['jest-junit', { outputDirectory: 'test-reports', outputName: 'report.xml' }],
Expand Down
32 changes: 23 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "open-source-portal-frontend",
"license": "UNLICENSED",
"private": true,
"version": "0.9.65-hotfix1",
"version": "1.0.0",
"scripts": {
"dev:base": "webpack serve --mode development",
"dev": "cross-env MOCK_API=always yarn dev:base",
Expand All @@ -16,11 +16,11 @@
"postinstall": "husky install",
"storybook": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"test": "jest",
"test:update": "jest -u",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:negative": "jest -t='\\[NEGATIVE\\]'"
"test": "cross-env TZ=UTC jest",
"test:update": "yarn test -u",
"test:watch": "yarn test --watch",
"test:coverage": "yarn test --coverage",
"test:negative": "yarn test -t='\\[NEGATIVE\\]'"
},
"packageManager": "[email protected]",
"engines": {
Expand All @@ -31,8 +31,11 @@
"@floating-ui/react-dom": "^1.0.0",
"@floating-ui/react-dom-interactions": "^0.9.3",
"@reduxjs/toolkit": "^1.8.1",
"@transcend-io/conflux": "^4.0.3",
"@types/d3": "^7.4.0",
"@types/react-dnd-html5-backend": "^3.0.2",
"@types/textarea-caret": "^3.0.1",
"antlr4": "^4.12.0",
"codemirror": "^5.65.8",
"connected-react-router": "^6.9.2",
"css-spring": "^4.1.0",
Expand All @@ -44,9 +47,11 @@
"lodash": "^4.17.21",
"luxon": "^2.4.0",
"password-validator": "^5.3.0",
"pdfjs-dist": "^3.4.120",
"qs": "^6.10.5",
"react": "^18.1.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dnd-touch-backend": "^16.0.1",
"react-dom": "^18.1.0",
"react-redux": "^8.0.2",
Expand All @@ -57,7 +62,11 @@
"react-virtual": "^2.10.4",
"resize-observer-polyfill": "^1.5.1",
"smoothscroll-polyfill": "^0.4.4",
"styled-components": "^5.3.5"
"streamsaver": "^2.0.6",
"styled-components": "^5.3.5",
"textarea-caret": "^3.1.0",
"uuid": "^9.0.0",
"web-streams-polyfill": "^3.2.1"
},
"resolutions": {
"loader-utils": "^2.0.4",
Expand All @@ -67,7 +76,9 @@
"trim": "^0.0.3",
"decode-uri-component": "^0.2.1",
"json5": "^2.2.2",
"luxon": "^2.5.2"
"luxon": "^2.5.2",
"http-cache-semantics": "4.1.1",
"webpack": "^5.76.0"
},
"devDependencies": {
"@babel/core": "^7.18.0",
Expand Down Expand Up @@ -100,7 +111,9 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-test-renderer": "^18.0.0",
"@types/react-transition-group": "^4.4.5",
"@types/streamsaver": "^2.0.1",
"@types/styled-components": "^5.1.25",
"@types/uuid": "^9.0.1",
"@types/webpack-env": "^1.17.0",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
Expand Down Expand Up @@ -135,6 +148,7 @@
"jsdom": "^20.0.1",
"lint-staged": "^12.4.1",
"mini-css-extract-plugin": "^2.6.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"prettier": "^2.6.2",
"react-refresh": "^0.13.0",
"react-test-renderer": "^18.2.0",
Expand All @@ -143,7 +157,7 @@
"ts-loader": "^9.3.0",
"typescript": "^4.6.4",
"typescript-plugin-styled-components": "^2.0.0",
"webpack": "^5.72.1",
"webpack": "^5.76.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0"
Expand Down
64 changes: 34 additions & 30 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import React from 'react';
import { Provider } from 'react-redux';
import { Route, Switch } from 'react-router-dom';
import { ConnectedRouter } from 'connected-react-router';
import { ThemeProvider } from 'styled-components';
import { DndProvider } from 'react-dnd';
import { TouchBackend } from 'react-dnd-touch-backend';

import { ThemeProvider } from 'styled-components';

import { store } from 'src/modules/store/store';
import { history, Path } from 'src/modules/navigation/store';
import PrivateRoute from 'src/modules/navigation/private-route/PrivateRoute';
Expand All @@ -24,39 +25,42 @@ import ForgotPassword from 'src/modules/auth/forgot-password/ForgotPassword';
import ForgotPasswordCheckMailbox from 'src/modules/auth/forgot-password/ForgotPasswordCheckMailbox';
import ResetPassword from 'src/modules/auth/forgot-password/ResetPassword';
import PasswordChanged from 'src/modules/auth/forgot-password/PasswordChanged';
import { ModalProvider } from 'src/common/components/Modal';

const App = () => (
<ThemeProvider theme={theme}>
<TooltipProvider>
<DndProvider backend={TouchBackend} options={{ enableMouseEvents: true }}>
<Provider store={store}>
<GlobalStyles />
<ConnectedRouter history={history}>
<Switch>
<Route path={Path.SignIn} component={SignInScreen} />
<Route path={Path.AccountActivation} component={AccountActivationScreen} />
<Route path={Path.AccountCreate} component={SignUp} />
<Route path={Path.AccountConfirm} component={CheckMailbox} />
<Route path={Path.AccountVerification} component={AccountCreated} />
<Route exact path={Path.ForgotPassword} component={ForgotPassword} />
<Route
exact
path={Path.ForgotPasswordConfirm}
component={ForgotPasswordCheckMailbox}
/>
<Route exact path={Path.ResetPassword} component={ResetPassword} />
<Route exact path={Path.ResetPasswordComplete} component={PasswordChanged} />
<PrivateRoute path={Path.CreateStudy}>
<CreateStudyScreen />
</PrivateRoute>
<PrivateRoute>
<MainLayout />
</PrivateRoute>
</Switch>
</ConnectedRouter>
</Provider>
<TooltipsList />
</DndProvider>
<ModalProvider>
<DndProvider backend={TouchBackend} options={{ enableMouseEvents: true }}>
<Provider store={store}>
<GlobalStyles />
<ConnectedRouter history={history}>
<Switch>
<Route path={Path.SignIn} component={SignInScreen} />
<Route path={Path.AccountActivation} component={AccountActivationScreen} />
<Route path={Path.AccountCreate} component={SignUp} />
<Route path={Path.AccountConfirm} component={CheckMailbox} />
<Route path={Path.AccountVerification} component={AccountCreated} />
<Route exact path={Path.ForgotPassword} component={ForgotPassword} />
<Route
exact
path={Path.ForgotPasswordConfirm}
component={ForgotPasswordCheckMailbox}
/>
<Route exact path={Path.ResetPassword} component={ResetPassword} />
<Route exact path={Path.ResetPasswordComplete} component={PasswordChanged} />
<PrivateRoute path={Path.CreateStudy}>
<CreateStudyScreen />
</PrivateRoute>
<PrivateRoute>
<MainLayout />
</PrivateRoute>
</Switch>
</ConnectedRouter>
</Provider>
<TooltipsList />
</DndProvider>
</ModalProvider>
</TooltipProvider>
</ThemeProvider>
);
Expand Down
13 changes: 13 additions & 0 deletions src/__mocks__/setUpDateMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let isEnabled = true;

const originalDateNow = Date.now;

Date.now = jest.fn(() => (isEnabled ? 1680842869025 : originalDateNow()));

export function enableDateNowMock() {
isEnabled = true;
}

export function disableDateNowMock() {
isEnabled = false;
}
4 changes: 4 additions & 0 deletions src/__mocks__/setUpTextDecoderMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { TextEncoder, TextDecoder } from 'util';

global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder as typeof global.TextDecoder;
1 change: 1 addition & 0 deletions src/__mocks__/setupCreateObjectUrlMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.URL.createObjectURL = jest.fn(() => 'blob:');
3 changes: 3 additions & 0 deletions src/__mocks__/setupGetComputedTextLengthMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
beforeAll(() => {
(SVGElement.prototype as SVGTextContentElement).getComputedTextLength = () => 0;
});
3 changes: 3 additions & 0 deletions src/__mocks__/setupScrollIntoViewMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
beforeAll(() => {
window.HTMLElement.prototype.scrollIntoView = jest.fn();
});
23 changes: 23 additions & 0 deletions src/assets/activity-task/6-mwt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8ce257c

Please sign in to comment.