smartenv/test/test.js

21 lines
2.4 KiB
JavaScript
Raw Normal View History

2016-11-21 11:04:57 +00:00
"use strict";
const smartenv = require("../dist/index.js");
const beautylog = require("beautylog");
2016-02-17 20:44:40 +00:00
smartenv.printEnv();
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-02-17 20:44:40 +00:00
smartenv.printEnv();
2016-11-21 10:58:37 +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
let key2 = 'hello';
smartenv.obs.get('myTestObject').key2 = key2;
beautylog.log(smartenv.obs.get('myTestObject').key2);
beautylog.success('Success!');
2016-11-21 11:04:57 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDZDQUE0QztBQUM1Qyx1Q0FBc0M7QUFDdEMsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFBO0FBRW5CLHdCQUF3QjtBQUN4QixRQUFRLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEVBQUMsRUFBQyxJQUFJLEVBQUMsT0FBTyxFQUFDLENBQUMsQ0FBQTtBQUMvQyxRQUFRLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEVBQUMsRUFBQyxJQUFJLEVBQUMsT0FBTyxFQUFDLENBQU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