Skip to content

Commit

Permalink
Merge pull request SunSpecOrangeButton#3 from joelebwf/jest
Browse files Browse the repository at this point in the history
Added JEST tests to the vue.js application.
  • Loading branch information
shelcrow committed Nov 20, 2019
2 parents 5164ed8 + 94b4cf0 commit 701305e
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 8 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# obtv
# OBTV

This is the future repository of Orange Button Taxonomy Vision.
The Orange Button Taxonomy Viewer is an in-development web application which allows Taxonomy Metadata to be browsed.

The application is composed of two parts:

* Vue.js front-end
* Python FLASK back-end

Currently the operational procedures are in flux and is not in a documented state. With this said run the viewer.py
python program for the back end and run the VUE application located in the web folder for the front end. Both
follow the default process for running Python and VUE programs and should be self explanatory. There is also an
in-progress disribution script which merges them together into a single application and although it may not fully
work without tweaking it could be used as a starting point.

Rudimentary unit tests are also available using pytest for the Python Code and Jest for the VUE code. The tests will
be flushed out as development continues.

Finally more documentation will be made available as development continues. In the meantime if you need help
please reach out on the [Orange Button Slack Channel](https://orange-button.slack.com/).
2 changes: 1 addition & 1 deletion web/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
// limitations under the License.

module.exports = {
presets: ["@vue/app"]
presets: ["@vue/cli-plugin-babel/preset"]
};
3 changes: 3 additions & 0 deletions web/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest'
}
24 changes: 19 additions & 5 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.0",
"bootstrap-vue": "^2.0.0-rc.27",
"core-js": "^2.6.5",
"core-js": "^3.3.2",
"vue": "^2.6.10",
"vue-awesome": "^3.5.4",
"vue-router": "^3.0.3",
"vuex": "^3.1.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.9.0",
"@vue/cli-plugin-eslint": "^3.9.0",
"@vue/cli-service": "^3.9.0",
"@vue/cli-plugin-babel": "^4.0.5",
"@vue/cli-plugin-eslint": "^4.0.5",
"@vue/cli-plugin-unit-jest": "^4.0.5",
"@vue/cli-service": "^4.0.5",
"@vue/eslint-config-prettier": "^4.0.1",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
Expand All @@ -38,7 +41,18 @@
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"overrides": [
{
"files": [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
"env": {
"jest": true
}
}
]
},
"postcss": {
"plugins": {
Expand Down
27 changes: 27 additions & 0 deletions web/tests/unit/basic.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { shallowMount } from '@vue/test-utils'
import App from "@/App.vue";
import router from "@/router.js";
import store from "@/store.js";
// Note: main.js does not work correctly with jest for unknown reasons and is not part of the test
// at this point in time.

// Jest requires one test case - for the time being it always returns true (a cat is a cat) but
// it also causes syntax check for all the Javascript/Vue files. Future expansion will add
// test cases.
describe('Main', () => {
it('compiles ', () => {
expect("cat").toMatch("cat")
})
})

0 comments on commit 701305e

Please sign in to comment.