mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-07 11:26:41 +00:00
Test drive.osx.list()
This commit is contained in:
parent
ad0be5f63c
commit
1ce7178aa3
@ -29,7 +29,7 @@ exports.list = (callback) ->
|
||||
|
||||
return {
|
||||
device: "/dev/#{device}"
|
||||
size: "#{size}#{sizeMeasure}"
|
||||
size: "#{size} #{sizeMeasure}"
|
||||
description: row.join(' ')
|
||||
}
|
||||
|
||||
|
49
lib/drive/osx.spec.coffee
Normal file
49
lib/drive/osx.spec.coffee
Normal file
@ -0,0 +1,49 @@
|
||||
chai = require('chai')
|
||||
expect = chai.expect
|
||||
sinon = require('sinon')
|
||||
chai.use(require('sinon-chai'))
|
||||
childProcess = require('child_process')
|
||||
osx = require('./osx')
|
||||
|
||||
describe 'Drive OSX:', ->
|
||||
|
||||
describe 'given correct output from diskdrive', ->
|
||||
|
||||
beforeEach ->
|
||||
@childProcessStub = sinon.stub(childProcess, 'exec')
|
||||
@childProcessStub.yields null, '''
|
||||
/dev/disk0
|
||||
#: TYPE NAME SIZE IDENTIFIER
|
||||
0: GUID_partition_scheme *750.2 GB disk0
|
||||
1: EFI EFI 209.7 MB disk0s1
|
||||
2: Apple_CoreStorage 749.3 GB disk0s2
|
||||
3: Apple_Boot Recovery HD 650.0 MB disk0s3
|
||||
/dev/disk1
|
||||
#: TYPE NAME SIZE IDENTIFIER
|
||||
0: Apple_HFS Macintosh HD *748.9 GB disk1
|
||||
Logical Volume on disk0s2
|
||||
3D74D961-80FB-4DB1-808F-8B5800C53E3A
|
||||
Unlocked Encrypted
|
||||
''', undefined
|
||||
|
||||
afterEach ->
|
||||
@childProcessStub.restore()
|
||||
|
||||
it 'should extract the necessary information', (done) ->
|
||||
osx.list (error, stdout) ->
|
||||
expect(error).to.not.exist
|
||||
|
||||
expect(stdout).to.deep.equal [
|
||||
{
|
||||
device: '/dev/disk0'
|
||||
description: 'GUID_partition_scheme'
|
||||
size: '*750.2 GB'
|
||||
}
|
||||
{
|
||||
device: '/dev/disk1'
|
||||
description: 'Apple_HFS Macintosh HD'
|
||||
size: '*748.9 GB'
|
||||
}
|
||||
]
|
||||
|
||||
return done()
|
Loading…
x
Reference in New Issue
Block a user