2014-12-02 11:28:49 -04:00
|
|
|
_ = require('lodash')
|
2014-12-09 12:46:02 -04:00
|
|
|
sinon = require('sinon')
|
2014-12-02 11:28:49 -04:00
|
|
|
chai = require('chai')
|
2014-12-05 12:52:31 -04:00
|
|
|
chai.use(require('chai-string'))
|
2014-12-02 11:28:49 -04:00
|
|
|
expect = chai.expect
|
|
|
|
os = require('./os')
|
|
|
|
|
|
|
|
describe 'OS:', ->
|
|
|
|
|
|
|
|
describe '#generateCacheName()', ->
|
|
|
|
|
|
|
|
describe 'given network is ethernet', ->
|
|
|
|
|
|
|
|
it 'should construct a correct name', ->
|
2014-12-05 12:52:31 -04:00
|
|
|
application =
|
|
|
|
id: 91
|
|
|
|
params:
|
|
|
|
network: 'ethernet'
|
|
|
|
|
2014-12-02 11:28:49 -04:00
|
|
|
result = os.generateCacheName(application.id, application.params)
|
2014-12-05 12:52:31 -04:00
|
|
|
expect(result).to.match(new RegExp("#{application.id}-ethernet-\\d\+\$"))
|
2014-12-02 11:28:49 -04:00
|
|
|
|
|
|
|
describe 'given network is wifi', ->
|
|
|
|
it 'should construct a correct name', ->
|
2014-12-05 12:52:31 -04:00
|
|
|
application =
|
|
|
|
id: 91
|
|
|
|
params:
|
|
|
|
network: 'wifi'
|
|
|
|
wifiSsid: 'MYSSID'
|
|
|
|
|
2014-12-02 11:28:49 -04:00
|
|
|
result = os.generateCacheName(application.id, application.params)
|
2014-12-05 12:52:31 -04:00
|
|
|
expect(result).to.match(new RegExp("#{application.id}-wifi-#{application.params.wifiSsid}-\\d\+\$"))
|