2016-11-21 10:58:37 +00:00
|
|
|
import * as smartenv from '../dist/index.js'
|
|
|
|
import * as beautylog from 'beautylog'
|
2017-04-19 18:02:43 +00:00
|
|
|
|
|
|
|
import { tap, expect } from 'tapbundle'
|
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
smartenv.printEnv()
|
2015-12-10 14:52:14 +00:00
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
// test smartenv.obs.add
|
|
|
|
smartenv.obs.add('myTestObject',{key1:'Peter'})
|
2016-11-21 11:04:57 +00:00
|
|
|
smartenv.obs.add('myTestObject',{key1:'Klaus'}) // now trying to add a second
|
2016-11-21 10:58:37 +00:00
|
|
|
smartenv.printEnv()
|
|
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1) // this should be Peter
|
2015-12-10 14:52:14 +00:00
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
// test smartenv.obs.replace
|
|
|
|
smartenv.obs.replace('myTestObject',{key1:'Klaus'})
|
|
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1) // this should be Klaus
|
2015-12-10 14:52:14 +00:00
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
// test smartenv.obs.merge
|
|
|
|
smartenv.obs.merge('myTestObject',{key2:'Peter'})
|
|
|
|
beautylog.log(smartenv.obs.get('myTestObject').key1 + smartenv.obs.get('myTestObject').key2)
|
|
|
|
// this should be KlausPeter
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
let key2 = 'hello'
|
|
|
|
smartenv.obs.get('myTestObject').key2 = key2
|
|
|
|
beautylog.log(smartenv.obs.get('myTestObject').key2)
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2016-11-21 10:58:37 +00:00
|
|
|
beautylog.success('Success!')
|