Commit af2cb7da authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Fixed a couple of issues uncovered by the store test

parent ee88756d
Pipeline #1868 passed with stage
in 9 minutes
......@@ -4,15 +4,18 @@ module.exports = config => {
config.set({
frameworks: ['jasmine'],
files: [
{pattern: 'test/**/*test.js'}
{pattern: 'test/**/*-test.js'}
],
browsers: ['PhantomJS'],
preprocessors: {
'test/**/*test.js': ['webpack', 'sourcemap']
'test/**/*-test.js': ['webpack']
},
webpack: webpackConfig,
webpackMiddleware: {
stats: 'errors-only'
noInfo: false,
stats: {
color: true
}
},
singleRun: true,
colors: true
......
......@@ -5,7 +5,7 @@
"author": "Sascha Herzinger",
"private": true,
"scripts": {
"build": "./node_modules/webpack/bin/webpack.js --config webpack.config.js",
"build": "./node_modules/webpack/bin/webpack.js --config webpack.config.js --env build",
"test": "./node_modules/karma/bin/karma start karma.config.js"
},
"dependencies": {
......@@ -17,9 +17,10 @@
"babel-core": "^6.24.0",
"babel-preset-latest": "^6.24.0",
"babel-polyfill": "^6.23.0",
"babel-plugin-add-module-exports": "^0.2.1",
"webpack": "^2.2.1",
"babel-loader": "^6.4.0",
"babel-loader": "^7.0.0-beta.1",
"vue-loader": "^11.1.4",
"css-loader": "^0.27.3",
......@@ -29,10 +30,10 @@
"eslint-plugin-promise": "^3.5.0",
"karma": "^1.5.0",
"jasmine-core": "^2.5.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4"
"karma-phantomjs-launcher": "^1.0.4",
"jasmine-core": "^2.5.2",
"karma-jasmine": "^1.1.0"
}
}
\ No newline at end of file
import 'babel-polyfill'
import { store } from './store'
import { RequestManager } from './services/request-manager'
import { ChartManager } from './services/chart-manager'
import store from './store/store'
import RequestManager from './services/request-manager'
import ChartManager from './services/chart-manager'
class FractalJS {
constructor (handler, thisBaseURL, fractalisBaseURL, getAuth) {
......
import Vue from 'vue'
import CorrelationAnalysis from '../components/charts/correlation-analysis.vue'
class ChartManager {
export default class {
constructor () {
this.AVAILABLE_CHARTS = {
'correlation-analysis': CorrelationAnalysis
......@@ -18,5 +18,3 @@ class ChartManager {
vm.$mount(elementId)
}
}
export { ChartManager }
\ No newline at end of file
import axios from 'axios'
class RequestManager {
export default class {
constructor ({handler, thisBaseURL, fractalisBaseURL, getAuth} = {}) {
this._handler = handler
this._thisBaseURL = thisBaseURL
......@@ -77,5 +77,3 @@ class RequestManager {
})
}
}
export { RequestManager }
export const subsets = state => state.subsets
import * as types from './mutation-types'
export default {
[types.SET_REQUEST_MANAGER] (state, { manager }) {
[types.SET_REQUEST_MANAGER] (state, manager) {
state.requestManager = manager
},
[types.SET_SUBSETS] (state, { subsets }) {
[types.SET_SUBSETS] (state, subsets) {
state.subsets = subsets
}
}
import 'babel-polyfill' // included here for testing
import Vue from 'vue'
import Vuex from 'vuex'
import * as getters from './getters'
......@@ -12,11 +11,9 @@ const state = {
subsets: []
}
const store = new Vuex.Store({
export default new Vuex.Store({
state,
getters,
actions,
mutations
})
export { store }
import { store } from '../src/store'
import 'babel-polyfill'
import store from '../src/store/store'
describe('store', () => {
it('should have working subsets setter', () => {
it('should have working setSubsets action', () => {
const subsets = [[1, 2, 3], [4, 5, 6], [6, 7, 8]]
store.dispatch('setSubsets', subsets)
expect(store.state.subsets).toEqual(subsets)
......
const webpack = require('webpack')
const path = require('path')
const env = require('yargs').argv.env;
let plugins = []
let filename = ''
const library = 'fractal'
if (env === 'build') {
plugins.push(new webpack.optimize.UglifyJsPlugin({minimize: true}))
filename = library + '.min.js'
} else {
filename = library + '.js'
}
module.exports = {
entry: path.resolve(__dirname, 'src/main.js'),
devtool: 'source-map',
entry: ['babel-polyfill', path.resolve(__dirname, 'src/main.js')],
devtool: '#inline-source-map',
plugins: plugins,
output: {
path: path.resolve(__dirname, 'lib'),
library: 'fractal',
library: library,
libraryTarget: 'var',
filename: 'fractal.js'
filename: filename
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
exclude: /node_modules/
exclude: /node_modules/,
options: {
// compile the <script></script> part of vue components with babel
loaders: {
js: 'babel-loader'
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'test')
],
exclude: /node_modules/
}
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment