Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Sample test for trying out unit tests with JsTestDriver

Mike McGannbe4ad496702d
diff --git a/ant/depend/js-test-driver/js-test-driver.build.xml b/ant/depend/js-test-driver/js-test-driver.build.xml
index 50a3ceecc..e8dc03af0 100644
--- a/ant/depend/js-test-driver/js-test-driver.build.xml
+++ b/ant/depend/js-test-driver/js-test-driver.build.xml
@@ -12,10 +12,11 @@
</target>
<target name="check-package">
- <available file="${js-test-driver.jar.path}" property="available"/>
+ <available file="${js-test-driver.jar.path}"
+ property="js-test-driver.available"/>
</target>
- <target name="copy" unless="available">
+ <target name="copy" unless="js-test-driver.available">
<copy todir="${lib.packages.dir}"
file="${lib.artifacts.dir}/${js-test-driver.jar}"/>
</target>
diff --git a/ant/depend/jsdoc-ant/jsdoc-ant.build.xml b/ant/depend/jsdoc-ant/jsdoc-ant.build.xml
index 50a52f9df..9e1c980f8 100644
--- a/ant/depend/jsdoc-ant/jsdoc-ant.build.xml
+++ b/ant/depend/jsdoc-ant/jsdoc-ant.build.xml
@@ -7,10 +7,10 @@
<target name="resolve" depends="build"/>
<target name="check-package">
- <available file="${jsdoc-ant.jar.path}" property="available"/>
+ <available file="${jsdoc-ant.jar.path}" property="jsdoc-ant.available"/>
</target>
- <target name="build" depends="check-package" unless="available">
+ <target name="build" depends="check-package" unless="jsdoc-ant.available">
<delete dir="${jsdoc-ant.repository}"/>
<!-- Don't pull history, just get the latest -->
diff --git a/ant/depend/jsdoc/jsdoc.build.xml b/ant/depend/jsdoc/jsdoc.build.xml
index dbb8f3de3..036e0fae2 100644
--- a/ant/depend/jsdoc/jsdoc.build.xml
+++ b/ant/depend/jsdoc/jsdoc.build.xml
@@ -12,10 +12,10 @@
</target>
<target name="check-package">
- <available file="${jsdoc.package.dir}" property="available"/>
+ <available file="${jsdoc.package.dir}" property="jsdoc.available"/>
</target>
- <target name="unpack" unless="available">
+ <target name="unpack" depends="check-package" unless="jsdoc.available">
<unzip src="${lib.artifacts.dir}/${jsdoc.artifact}"
dest="${lib.packages.dir}"/>
diff --git a/ant/depend/yui-compressor-ant/yui-compressor-ant.build.xml b/ant/depend/yui-compressor-ant/yui-compressor-ant.build.xml
index 3480eeb66..d99937187 100644
--- a/ant/depend/yui-compressor-ant/yui-compressor-ant.build.xml
+++ b/ant/depend/yui-compressor-ant/yui-compressor-ant.build.xml
@@ -12,10 +12,12 @@
</target>
<target name="check-package">
- <available file="${yui-compressor-ant.package.dir}" property="available"/>
+ <available file="${yui-compressor-ant.package.dir}"
+ property="yui-compressor-ant.available"/>
</target>
- <target name="unpack" unless="available">
+ <target name="unpack" depends="check-package"
+ unless="yui-compressor-ant.available">
<unzip src="${lib.artifacts.dir}/${yui-compressor-ant.artifact}"
dest="${lib.packages.dir}/${yui-compressor-ant.package}"/>
</target>
diff --git a/ant/depend/yui-compressor/yui-compressor.build.xml b/ant/depend/yui-compressor/yui-compressor.build.xml
index 79359b669..4a23bbdaa 100644
--- a/ant/depend/yui-compressor/yui-compressor.build.xml
+++ b/ant/depend/yui-compressor/yui-compressor.build.xml
@@ -12,10 +12,12 @@
</target>
<target name="check-package">
- <available file="${yui-compressor.package.dir}" property="available"/>
+ <available file="${yui-compressor.package.dir}"
+ property="yui-compressor.available"/>
</target>
- <target name="unpack" unless="available">
+ <target name="unpack" depends="check-package"
+ unless="yui-compressor.available">
<unzip src="${lib.artifacts.dir}/${yui-compressor.artifact}"
dest="${lib.packages.dir}"/>
</target>
diff --git a/build.xml b/build.xml
index 2d0db3195..94df54389 100644
--- a/build.xml
+++ b/build.xml
@@ -40,9 +40,7 @@
<taskdef name="jsdoc"
classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"
classpath="${jsdoc-ant.jar.path}:${jsdoc.home.dir}/java/classes/js.jar"/>
-
- <echo message="classpath: ${yui-compressor.jar.path}:${yui-compressor-ant.jar.path}"/>
-
+
<taskdef name="yui-compressor"
classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask"
classpath="${yui-compressor.jar.path}:${yui-compressor-ant.jar.path}"/>
@@ -164,6 +162,23 @@
</target>
+ <target name="test" depends="web">
+ <delete dir="${build.test.dir}"/>
+ <mkdir dir="${build.test.dir}"/>
+ <exec executable="java">
+ <arg value="-jar"/>
+ <arg value="${js-test-driver.jar.path}"/>
+ <arg value="--port"/>
+ <arg value="${js-test-driver.port}"/>
+ <arg value="--browser"/>
+ <arg value="${js-test-driver.macosx.browsers}"/>
+ <arg value="--tests"/>
+ <arg value="all"/>
+ <arg value="--testOutput"/>
+ <arg value="${build.test.dir}"/>
+ </exec>
+ </target>
+
<target name="dist" depends="clean,web,doc"
description="Generates distribution artifacts">
<tar destfile="${dist.dir}/worldview.tar.bz2"
diff --git a/jsTestDriver.conf b/jsTestDriver.conf
new file mode 100644
index 000000000..213ae5005
--- /dev/null
+++ b/jsTestDriver.conf
@@ -0,0 +1,9 @@
+server: http://localhost:8811
+
+load:
+ - build/worldview/js/worldview-min.js
+
+test:
+ - test/*.js
+
+timeout: 90
diff --git a/test/helloWorld.js b/test/helloWorld.js
new file mode 100644
index 000000000..7dbbe5c06
--- /dev/null
+++ b/test/helloWorld.js
@@ -0,0 +1,6 @@
+HelloWorldTest = TestCase("HelloWorldTest");
+
+HelloWorldTest.prototype.testHelloWorld = function() {
+ assertEquals(true, true);
+}
+