tv : function (test) { 'use strict'; var tv = require(__dirname + '/../../../../apps/gerty/tv'), deviceOn = tv.mood({ state : 'ok' }), deviceOff = tv.mood({ state : 'err' }); test.deepEqual(deviceOn, { entertained : 3 }, 'You should feel entertained'); test.deepEqual(deviceOff, { entertained : 0 }, 'You should feel bored'); test.done(); }
airQuality : function (test) { 'use strict'; var airQuality = require(__dirname + '/../../../../apps/gerty/airQuality'), allGood = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.015 }, { type : 'pm25', value : 10 }, { type : 'co', value : 2 }] } }), allBad = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.25 }, { type : 'pm25', value : 160 }, { type : 'co', value : 25 }] } }), mixed = airQuality.mood({ value : { report : [{ type : 'no2', value : 0.015 }, { type : 'pm25', value : 160 }, { type : 'co', value : 2 }] } }); test.deepEqual(allGood, { scared : 0, comfortable : 3 }, 'All good'); test.deepEqual(allBad, { scared : 5, comfortable : -5 }, 'All bad'); test.deepEqual(mixed, { scared : 2, comfortable : 0 }, 'A mix of good and bad'); test.done(); }
activeBuilding : function (test) { 'use strict'; var activeBuilding = require(__dirname + '/../../../../apps/gerty/activeBuilding'), deviceGood = activeBuilding.mood({ value : ['USPS', 'UPS', 'Dry Cleaning']}), deviceOk = activeBuilding.mood({ value : ['USPS']}), deviceBad = activeBuilding.mood({ value : []}); test.deepEqual(deviceGood, { excited: 6 }, 'How exciting. You have several packages'); test.deepEqual(deviceOk, { excited: 2 }, 'You have one package waiting'); test.deepEqual(deviceBad, { excited: 0 }, 'Nothing special here'); test.done(); }