balena-cli/lib/cache/cache.spec.coffee

33 lines
875 B
CoffeeScript
Raw Normal View History

2014-12-02 11:28:49 -04:00
_ = require('lodash')
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
cache = require('./cache')
2014-12-02 11:28:49 -04:00
describe 'Cache:', ->
2014-12-02 11:28:49 -04:00
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'
result = cache.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'
result = cache.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\+\$"))