2015-11-26 05:31:31 +00:00
|
|
|
/// <reference path="typings/tsd.d.ts" />
|
|
|
|
var smartenv = require("./index.js");
|
|
|
|
var beautylog = require("beautylog")("os");
|
|
|
|
beautylog.info("Now testing the smartenv module");
|
2015-11-30 14:04:04 +00:00
|
|
|
smartenv.printEnv();
|
2015-11-26 05:51:13 +00:00
|
|
|
beautylog.info("Now testing the smartenv module");
|
2015-12-10 14:52:14 +00:00
|
|
|
|
|
|
|
//test smartenv.obs.add
|
|
|
|
smartenv.obs.add("myTestObject",{key1:"Peter"});
|
|
|
|
smartenv.obs.add("myTestObject",{key1:"Klaus"}); //now trying to add a second
|
2015-11-30 14:04:04 +00:00
|
|
|
smartenv.printEnv();
|
2015-12-10 14:52:14 +00:00
|
|
|
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Peter
|
|
|
|
|
|
|
|
//test smartenv.obs.replace
|
|
|
|
smartenv.obs.replace("myTestObject",{key1:"Klaus"});
|
|
|
|
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Klaus
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
|
|
var key2 = "hello";
|
2015-12-10 14:52:14 +00:00
|
|
|
smartenv.obs.get("myTestObject").key2 = key2;
|
|
|
|
beautylog.log(smartenv.obs.get("myTestObject").key2);
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2015-11-26 05:31:31 +00:00
|
|
|
beautylog.success("Success!");
|