Interactive interface for browsing global, full-resolution satellite imagery
Stub modularized Buster tests
Jo Sprague278120d09007
diff --git a/buster.js b/buster.jsindex 3bc2b9dbf..42c9e20b2 100644--- a/buster.js+++ b/buster.js@@ -3,29 +3,8 @@ var config = module.exports;config['wv'] = {rootPath: './',environment: 'browser',- libs: [- 'web/ext/main/lodash-2.4.1/lodash.js',- 'web/ext/main/jquery-2.1.4/jquery.js',- 'web/ext/main/jquery.migrate-1.2.1/jquery-migrate.min.js',- 'web/ext/main/jscache-gitba01cdc/cache.js',- 'web/ext/proj/proj4js-2.3.3-1/proj4.js',- 'node_modules/openlayers/dist/ol-debug.js',- 'test/fixtures.js'- ],src: [- 'web/js/util/wv.*.js',- 'web/js/wv.*.js',- '!web/js/wv.main.js',- 'web/js/ui/wv.ui.js',- 'web/js/ui/wv.ui.mouse.js',- 'web/js/ui/wv.ui.indicator.js',- 'web/js/date/wv.*.js',- 'web/js/layers/wv.*.js',- 'web/js/link/wv.*.js',- 'web/js/palettes/wv.*.js',- 'web/js/proj/wv.*.js',- 'web/js/data/wv.*.js',- 'web/js/map/wv.*.js'+ 'web/build/wv-test-bundle.js'],- tests: ['test/**/*.js']+ tests: ['test/**/*-spec.js']};diff --git a/package.json b/package.jsonindex 9a606fd33..41d710b6b 100644--- a/package.json+++ b/package.json@@ -26,7 +26,8 @@"report": "node e2e/create-report.js","build": "run-s --print-name build:* && grunt","build:css": "node ./tasks/buildCSS",- "build:js": "node ./tasks/buildJS"+ "build:js": "node ./tasks/buildJS",+ "build:tests": "node ./tasks/buildJS --tests"},"devDependencies": {"autoprefixer": "7.1.1",@@ -67,6 +68,7 @@"grunt-rename": "0.1.x","grunt-text-replace": "0.4.x","gruntify-eslint": "^4.0.0",+ "minimist": "^1.2.0","moment": "2.13.x","nightwatch": "^0.9.16","nightwatch-cucumber": "^8.2.10",diff --git a/tasks/buildJS.js b/tasks/buildJS.jsindex cfd10ba43..625d7cd7e 100644--- a/tasks/buildJS.js+++ b/tasks/buildJS.js@@ -2,11 +2,14 @@const fs = require('fs');const browserify = require('browserify');const watchify = require('watchify');+const minimist = require('minimist');+const argv = minimist(process.argv.slice(2));const isDebug = process.env.NODE_ENV === 'development';+const isTest = argv.tests;const outputDir = './web/build/';-const entryPoint = './web/js/main.js';-const outputPath = outputDir + 'wv.js';+const entryPoint = isTest ? './test/main.js' : './web/js/main.js';+const outputPath = outputDir + (isTest ? 'wv-test-bundle.js' : 'wv.js');var bundler = browserify(entryPoint, {debug: isDebug, // Include source maps (makes bundle size larger)diff --git a/test/wv.brand-test.js b/test/brand-spec.jssimilarity index 100%rename from test/wv.brand-test.jsrename to test/brand-spec.jsdiff --git a/test/date/wv.date-test.js b/test/date/date-spec.jssimilarity index 100%rename from test/date/wv.date-test.jsrename to test/date/date-spec.jsdiff --git a/test/fixtures.js b/test/fixtures.jsindex 3a3300354..632c01689 100644--- a/test/fixtures.js+++ b/test/fixtures.js@@ -1,6 +1,12 @@+import { dateModel } from '../web/js/date/model';+import { layersModel } from '../web/js/layers/model';+import { mapModel } from '../web/js/map/model';+import { palettesModel } from '../web/js/palettes/model';+import { projectionModel } from '../web/js/projection/model';+// FIXME: OL3-proj4.defs('EPSG:3413', '+title=WGS 84 / NSIDC Sea Ice Polar Stereographic North +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');-proj4.defs('EPSG:3031', '+title=WGS 84 / Antarctic Polar Stereographic +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');+// proj4.defs('EPSG:3413', '+title=WGS 84 / NSIDC Sea Ice Polar Stereographic North +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');+// proj4.defs('EPSG:3031', '+title=WGS 84 / Antarctic Polar Stereographic +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');var fixtures = {red: 'ff0000ff',@@ -148,11 +154,13 @@ fixtures.config = function () {fixtures.models = function (config) {var models = {};- models.date = wv.date.model(config);- models.proj = wv.proj.model(config);- models.layers = wv.layers.model(models, config);- models.palettes = wv.palettes.model(models, config);- models.map = wv.map.model(models, config);+ models.date = dateModel(config);+ models.proj = projectionModel(config);+ models.layers = layersModel(models, config);+ models.palettes = palettesModel(models, config);+ models.map = mapModel(models, config);return models;};++export default fixtures;diff --git a/test/main.js b/test/main.jsnew file mode 100644index 000000000..255cca9e4--- /dev/null+++ b/test/main.js@@ -0,0 +1,16 @@+// This file is an entry point used to build a testable bundle of the WV core+// It exposes some internal methods on a global `wv` var for testing purposes+import brand from '../web/js/brand';+import { parse as dateParser } from '../web/js/date/date';+import util from '../web/js/util/util';+import fixtures from './fixtures.js';++window.wv = {+ brand: brand,+ date: {+ parse: dateParser+ },+ util: util+};++window.fixtures = fixtures;