2753: Add tests for CollectionsHelper.file_path.
[arvados.git] / apps / workbench / test / unit / helpers / collections_helper_test.rb
index 16a85d9bcaabe56f6b2ead2568f434b6d00507ca..56d23c5c37fc7948b938ed8b737e59ff90f23db8 100644 (file)
@@ -1,4 +1,12 @@
 require 'test_helper'
 
 class CollectionsHelperTest < ActionView::TestCase
+  test "file_path generates short names" do
+    assert_equal('foo', CollectionsHelper.file_path(['.', 'foo', 0]),
+                 "wrong result for filename in collection root")
+    assert_equal('foo/bar', CollectionsHelper.file_path(['foo', 'bar', 0]),
+                 "wrong result for filename in directory without leading .")
+    assert_equal('foo/bar', CollectionsHelper.file_path(['./foo', 'bar', 0]),
+                 "wrong result for filename in directory with leading .")
+  end
 end