Skip to content

Commit

Permalink
Initial commit for unit tests
Browse files Browse the repository at this point in the history
ref #1264
  • Loading branch information
jackgrossman18 committed Nov 9, 2018
1 parent 1a51ee1 commit 810f457
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 244 deletions.
13 changes: 4 additions & 9 deletions dist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7256,9 +7256,6 @@
"SPW_PICC": {
"name": "SPW(allonie) PICC numerical imagery"
},
"US-TIGER-Roads-2012": {
"name": "TIGER Roads 2012"
},
"US-TIGER-Roads-2014": {
"description": "At zoom level 16+, public domain map data from the US Census. At lower zooms, only changes since 2006 minus changes already incorporated into OpenStreetMap",
"name": "TIGER Roads 2014"
Expand All @@ -7267,6 +7264,10 @@
"description": "Yellow = Public domain map data from the US Census. Red = Data not found in OpenStreetMap",
"name": "TIGER Roads 2017"
},
"US-TIGER-Roads-2018": {
"description": "Yellow = Public domain map data from the US Census. Red = Data not found in OpenStreetMap",
"name": "TIGER Roads 2018"
},
"US_Forest_Service_roads_overlay": {
"description": "Highway: Green casing = unclassified. Brown casing = track. Surface: gravel = light brown fill, Asphalt = black, paved = gray, ground =white, concrete = blue, grass = green. Seasonal = white bars",
"name": "U.S. Forest Roads Overlay"
Expand Down Expand Up @@ -7374,12 +7375,6 @@
"description": "Orthophotos from the municipality of Helsingborg 2016, public domain",
"name": "Helsingborg Orthophoto"
},
"hike_n_bike": {
"attribution": {
"text": "© OpenStreetMap contributors"
},
"name": "Hike & Bike"
},
"kalmar-orto-2014": {
"attribution": {
"text": "© Kalmar municipality"
Expand Down
255 changes: 131 additions & 124 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,145 +1,152 @@
// Karma configuration
// Generated on Mon Oct 29 2018 14:12:47 GMT-0400 (Eastern Daylight Time)

const path = require( 'path' );
const Merge = require( 'webpack-merge' );
const baseConfig = require( './webpack-config/webpack.base.config' );
const path = require("path");
const Merge = require("webpack-merge");
const baseConfig = require("./webpack-config/webpack.base.config");

const materialIconFiles = [
{ pattern: 'node_modules/material-design-icons/iconfont/material-icons.css', included: true },
{ pattern: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.eot', included: false },
{ pattern: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.svg', included: false },
{ pattern: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf', included: false },
{ pattern: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff', included: false },
{ pattern: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2', included: false },
{
pattern: "node_modules/material-design-icons/iconfont/material-icons.css",
included: true
},
{
pattern:
"node_modules/material-design-icons/iconfont/MaterialIcons-Regular.eot",
included: false
},
{
pattern:
"node_modules/material-design-icons/iconfont/MaterialIcons-Regular.svg",
included: false
},
{
pattern:
"node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf",
included: false
},
{
pattern:
"node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff",
included: false
},
{
pattern:
"node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2",
included: false
}
];

const webpackConfig = Merge( baseConfig, {
mode: 'development',
entry: './test/hoot/index.js',
module: {
rules: [
// instrument only testing sources with Istanbul
{
test: /\.js$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
},
include: path.resolve( __dirname, 'modules/Hoot/' ),
enforce: 'post'
// exclude: /node_modules|\.spec\.js$/
}
]
},
resolve: {
alias: {
img: path.resolve( __dirname, 'img' ),
lib: path.resolve( __dirname, 'modules/lib' )
}
},
} );

module.exports = function( config ) {
config.set( {

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ 'mocha' ],


client: {
mocha: {
timeout: 5000
}
const webpackConfig = Merge(baseConfig, {
mode: "development",
entry: "./test/hoot/index.js",
module: {
rules: [
// instrument only testing sources with Istanbul
{
test: /\.js$/,
use: {
loader: "istanbul-instrumenter-loader",
options: { esModules: true }
},
include: path.resolve(__dirname, "modules/Hoot/"),
enforce: "post"
// exclude: /node_modules|\.spec\.js$/
}
]
},
resolve: {
alias: {
img: path.resolve(__dirname, "img"),
lib: path.resolve(__dirname, "modules/lib")
}
}
});

module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["mocha"],

client: {
mocha: {
timeout: 5000
}
},

// list of files / patterns to load in the browser
files: [
...materialIconFiles,

{ pattern: "img/**/*.svg", included: false },
{ pattern: "img/**/*.png", included: false },
{ pattern: "img/**/*.gif", included: false },

{ pattern: "test/data/UndividedHighway.osm", included: false },
{ pattern: "test/data/ImportMultiTest.dbf", included: false },
{ pattern: "test/data/ImportMultiTest.shp", included: false },
{ pattern: "test/data/ImportMultiTest.shx", included: false },

"css/**/*.css",
"css/**/*.scss",
"test/hoot/index.js"
],

// list of files / patterns to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"test/hoot/index.js": ["webpack"],
"test/hoot/helpers.js": ["webpack"],
"css/**/*.scss": ["scss"]
},

// list of files / patterns to load in the browser
files: [
...materialIconFiles,

{ pattern: 'img/**/*.svg', included: false },
{ pattern: 'img/**/*.png', included: false },
{ pattern: 'img/**/*.gif', included: false },

{ pattern: 'test/data/UndividedHighway.osm', included: false },
{ pattern: 'test/data/ImportMultiTest.dbf', included: false },
{ pattern: 'test/data/ImportMultiTest.shp', included: false },
{ pattern: 'test/data/ImportMultiTest.shx', included: false },

'css/**/*.css',
'css/**/*.scss',
'test/hoot/index.js'
],


// list of files / patterns to exclude
exclude: [],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/hoot/index.js': [ 'webpack' ],
'test/hoot/helpers.js': [ 'webpack' ],
'css/**/*.scss': [ 'scss' ]
},


proxies: {
'/img/': '/base/img/'
},


webpack: webpackConfig,


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: [ 'spec', 'coverage-istanbul' ],


coverageIstanbulReporter: {
reports: [ 'html', 'lcov', 'text-summary' ],
dir: path.join( __dirname, 'coverage' ),
fixWebpackSourcePaths: true
},


// web server port
port: 9876,

proxies: {
"/img/": "/base/img/"
},

// enable / disable colors in the output (reporters and logs)
colors: true,
webpack: webpackConfig,

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["spec", "coverage-istanbul"],

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
coverageIstanbulReporter: {
reports: ["html", "lcov", "text-summary"],
dir: path.join(__dirname, "coverage"),
fixWebpackSourcePaths: true
},

// web server port
port: 9876,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [ 'Chrome' ],
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ["Chrome"],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: 1
} );
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1
});
};
Loading

0 comments on commit 810f457

Please sign in to comment.