summaryrefslogtreecommitdiff
path: root/examples/testing/src/test/scala/CollectionTest.scala
diff options
context:
space:
mode:
authorHaoyi Li <haoyi@haoyi-mbp.corp.dropbox.com>2014-11-26 00:45:31 -0800
committerHaoyi Li <haoyi@haoyi-mbp.corp.dropbox.com>2014-11-26 00:45:31 -0800
commit2c4b142503bd2d871e6818b5cab8c38627d9e4a0 (patch)
tree6ba33d2980a1a7a1286100202a695c6631bd240e /examples/testing/src/test/scala/CollectionTest.scala
downloadhands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.gz
hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.bz2
hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.zip
Squashed 'examples/scala-js/' content from commit 47311ba
git-subtree-dir: examples/scala-js git-subtree-split: 47311ba693f949f204f27ea9475bb63425fbd4f3
Diffstat (limited to 'examples/testing/src/test/scala/CollectionTest.scala')
-rw-r--r--examples/testing/src/test/scala/CollectionTest.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/testing/src/test/scala/CollectionTest.scala b/examples/testing/src/test/scala/CollectionTest.scala
new file mode 100644
index 0000000..a586ca2
--- /dev/null
+++ b/examples/testing/src/test/scala/CollectionTest.scala
@@ -0,0 +1,17 @@
+import scala.scalajs.js
+import scala.scalajs.js.Dynamic.global
+import scala.scalajs.js.JSConverters._
+
+import org.scalajs.jasminetest.JasmineTest
+
+object CollectionTest extends JasmineTest {
+
+ describe("Array") {
+
+ it("should be able to map and filter integers") {
+ val array = Array(5, 7, 2, 6, -30, 33, 66, 76, 75, 0)
+ val result = array.filter(_.toInt % 3 != 0).map(x => x*x)
+ expect(result.toJSArray).toEqual(js.Array(25, 49, 4, 76*76))
+ }
+ }
+}