diff --git a/.babelrc b/.babelrc index 86c445f5..b9318605 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,10 @@ { - "presets": ["es2015", "react"] + "presets": ["es2015", "react"], + + "env": { + "test": { + "plugins": ["syntax-class-properties", + "transform-class-properties"] + } + } } diff --git a/app/static/app/js/Console.jsx b/app/static/app/js/Console.jsx index d4e1ab9f..de56c936 100644 --- a/app/static/app/js/Console.jsx +++ b/app/static/app/js/Console.jsx @@ -4,6 +4,7 @@ import './vendor/google-code-prettify/prettify'; import './vendor/google-code-prettify/prettify.css'; import update from 'immutability-helper'; import Utils from './classes/Utils'; +import $ from 'jquery'; class Console extends React.Component { constructor(props){ diff --git a/app/static/app/js/components/tests/AssetDownloadButtons.test.jsx b/app/static/app/js/components/tests/AssetDownloadButtons.test.jsx new file mode 100644 index 00000000..ccfead6f --- /dev/null +++ b/app/static/app/js/components/tests/AssetDownloadButtons.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import AssetDownloadButtons from '../AssetDownloadButtons'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/EditPresetDialog.test.jsx b/app/static/app/js/components/tests/EditPresetDialog.test.jsx new file mode 100644 index 00000000..f4a30c6f --- /dev/null +++ b/app/static/app/js/components/tests/EditPresetDialog.test.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import EditPresetDialog from '../EditPresetDialog'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/tests/Console.test.jsx b/app/static/app/js/tests/Console.test.jsx new file mode 100644 index 00000000..175be98a --- /dev/null +++ b/app/static/app/js/tests/Console.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Console from '../Console'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/tests/Dashboard.test.jsx b/app/static/app/js/tests/Dashboard.test.jsx index d5c18c0b..358d6f56 100644 --- a/app/static/app/js/tests/Dashboard.test.jsx +++ b/app/static/app/js/tests/Dashboard.test.jsx @@ -1,3 +1,4 @@ +import React from 'react'; import { shallow } from 'enzyme'; import Dashboard from '../Dashboard'; diff --git a/app/static/app/js/tests/MapView.test.jsx b/app/static/app/js/tests/MapView.test.jsx new file mode 100644 index 00000000..5769e9d0 --- /dev/null +++ b/app/static/app/js/tests/MapView.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import MapView from '../MapView'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/tests/ModelView.test.jsx b/app/static/app/js/tests/ModelView.test.jsx new file mode 100644 index 00000000..d9e40569 --- /dev/null +++ b/app/static/app/js/tests/ModelView.test.jsx @@ -0,0 +1,13 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +// import ModelView from '../ModelView'; + +// TODO: this needs some debugging since Potree has troubles with requirements + +describe('', () => { + it('TODO: renders without exploding', () => { + expect(true).toBe(true); +// const wrapper = shallow(); +// expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/tests/mocks/empty.scss.js b/app/static/app/js/tests/mocks/empty.scss.js index 0b161a9a..a79ebb87 100644 --- a/app/static/app/js/tests/mocks/empty.scss.js +++ b/app/static/app/js/tests/mocks/empty.scss.js @@ -3,4 +3,6 @@ Currently we don't transpile SCSS files when testing with Jest. We might want to change this in the future if we start doing snapshot -testing */ \ No newline at end of file +testing */ + +export default {}; \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 17e28e50..df3d051f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,7 @@ module.exports = { roots: ["./app/static/app/js"], "moduleNameMapper": { - "^.*\\.scss$": "./tests/mocks/empty.scss.js" // TODO: how to use an absolute path? + "^.*\\.s?css$": "/app/static/app/js/tests/mocks/empty.scss.js", + "jquery": "/app/static/app/js/vendor/jquery-1.11.2.min.js" } }; \ No newline at end of file diff --git a/package.json b/package.json index 97075838..a7ed96ff 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "webodm", + "name": "WebODM", "version": "0.4.0", "description": "Open Source Drone Image Processing", "main": "index.js",