Skip to content

Commit e69db95

Browse files
committed
Fix test
1 parent 710c4ed commit e69db95

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/java/io/ipfs/api/APITest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ public void directoryTest() throws IOException {
137137
List<MerkleNode> addParts = ipfs.add(new NamedStreamable.FileWrapper(tmpDir.toFile()));
138138
MerkleNode addResult = addParts.get(addParts.size() - 1);
139139
List<MerkleNode> lsResult = ipfs.ls(addResult.hash);
140-
if (lsResult.size() != 1)
140+
if (lsResult.size() != 2)
141141
throw new IllegalStateException("Incorrect number of objects in ls!");
142-
if (!lsResult.get(0).equals(addResult))
143-
throw new IllegalStateException("Object not returned in ls!");
142+
if (! lsResult.stream().map(x -> x.name.get()).collect(Collectors.toSet()).equals(Set.of(subdirName, fileName)))
143+
throw new IllegalStateException("Dir not returned in ls!");
144144
byte[] catResult = ipfs.cat(addResult.hash, "/" + fileName);
145-
if (!Arrays.equals(catResult, fileContents))
145+
if (! Arrays.equals(catResult, fileContents))
146146
throw new IllegalStateException("Different contents!");
147147

148148
byte[] catResult2 = ipfs.cat(addResult.hash, "/" + subdirName + "/" + subfileName);
149-
if (!Arrays.equals(catResult2, file2Contents))
149+
if (! Arrays.equals(catResult2, file2Contents))
150150
throw new IllegalStateException("Different contents!");
151151
}
152152

0 commit comments

Comments
 (0)