Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
more tests + testability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenpeeters committed Apr 4, 2017
1 parent 7feb690 commit f37f3d2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/coffee/storage.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ describe 'Storage', ->
captor.value()
td.verify fs.unlink '/rootDir/myDomain/.bucket1.copy.lock', 'mycallback'

it 'should report the size of a storage bucket when /storage/size is invoked', ->
agent = td.object ['on']
cb = td.function()
captor = td.matchers.captor()
storage agent, null, dataDir: '/rootDir', domain: 'myDomain', remotefsUrl: 'remotefsUrl'
td.verify agent.on '/storage/size', captor.capture()
captor.value {name: 'bucket1'}, null, cb
td.verify fs.writeFile '/rootDir/myDomain/.bucket1.size.lock', td.matchers.anything(), captor.capture()
captor.value()
td.verify storageLib.remoteFs 'remotefsUrl', 'du', {dir: '/myDomain/bucket1'}, captor.capture()
captor.value null, {size: 1234}
td.verify fs.unlink '/rootDir/myDomain/.bucket1.size.lock', captor.capture()
captor.value()
td.verify cb null, {name: 'bucket1', size: 1234}

it 'should periodically publish data storage statistics to mqtt', ->
agent = td.object ['on']
Expand Down

0 comments on commit f37f3d2

Please sign in to comment.