Updated test to reflect changes to getFileListing method
authorFuad Muhic <fmuhic@capeannenterprises.com>
Fri, 26 Jan 2018 15:04:32 +0000 (16:04 +0100)
committerFuad Muhic <fmuhic@capeannenterprises.com>
Fri, 26 Jan 2018 15:04:32 +0000 (16:04 +0100)
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic@capeannenterprises.com>

sdk/R/tests/testthat/test-Subcollection.R

index 401b086a0c3d51ab1ae15768473bf348024fb0e3..b155ed4ccbcafd2f2badd4170dd9f7f319b41e0b 100644 (file)
@@ -13,7 +13,7 @@ test_that("getRelativePath returns path relative to the tree root", {
     expect_that(fish$getRelativePath(), equals("animal/fish"))
 }) 
 
-test_that(paste("getFileListing by default returns path of all files",
+test_that(paste("getFileListing by default returns sorted path of all files",
                 "relative to the current subcollection"), {
 
     animal   <- Subcollection$new("animal")
@@ -26,7 +26,9 @@ test_that(paste("getFileListing by default returns path of all files",
     fish$add(blueFish)
 
     result <- animal$getFileListing()
-    expectedResult <- c("animal/fish/shark", "animal/fish/blueFish")
+
+    #expect sorted array
+    expectedResult <- c("animal/fish/blueFish", "animal/fish/shark")
 
     resultsMatch <- length(expectedResult) == length(result) &&
                     all(expectedResult == result)
@@ -34,7 +36,7 @@ test_that(paste("getFileListing by default returns path of all files",
     expect_that(resultsMatch, is_true())
 }) 
 
-test_that(paste("getFileListing returns names of all direct children",
+test_that(paste("getFileListing returns sorted names of all direct children",
                 "if fullPath is set to FALSE"), {
 
     animal <- Subcollection$new("animal")
@@ -47,7 +49,7 @@ test_that(paste("getFileListing returns names of all direct children",
     fish$add(shark)
 
     result <- animal$getFileListing(fullPath = FALSE)
-    expectedResult <- c("fish", "dog")
+    expectedResult <- c("dog", "fish")
 
     resultsMatch <- length(expectedResult) == length(result) &&
                     all(expectedResult == result)