mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-08 16:19:17 +03:00
Update fs spec for new traverseTree callbacks
This commit is contained in:
parent
8b61e6a9df
commit
1be1d03eac
@ -62,7 +62,7 @@ describe "fs", ->
|
||||
fs.makeTree("/tmp/a/b/c")
|
||||
expect(fs.exists("/tmp/a/b/c")).toBeTruthy()
|
||||
|
||||
describe ".traverseTree(path, fn)", ->
|
||||
describe ".traverseTree(path, onFile, onDirectory)", ->
|
||||
fixturesDir = null
|
||||
|
||||
beforeEach ->
|
||||
@ -70,19 +70,21 @@ describe "fs", ->
|
||||
|
||||
it "calls fn for every path in the tree at the given path", ->
|
||||
paths = []
|
||||
fs.traverseTree fixturesDir, (path) ->
|
||||
onPath = (path) ->
|
||||
paths.push(fs.join(fixturesDir, path))
|
||||
true
|
||||
fs.traverseTree fixturesDir, onPath, onPath
|
||||
expect(paths).toEqual fs.listTree(fixturesDir)
|
||||
|
||||
it "does not recurse into a directory if it is pruned", ->
|
||||
paths = []
|
||||
fs.traverseTree fixturesDir, (path, prune) ->
|
||||
onPath = (path) ->
|
||||
if path.match(/\/dir$/)
|
||||
false
|
||||
else
|
||||
paths.push(path)
|
||||
true
|
||||
fs.traverseTree fixturesDir, onPath, onPath
|
||||
|
||||
expect(paths.length).toBeGreaterThan 0
|
||||
for path in paths
|
||||
|
Loading…
Reference in New Issue
Block a user