Skip to content
Browse files

continued work on the datastore

  • Loading branch information...
1 parent 3d28a20 commit 61f14ea8bd42c49893daef96f8d3e75b9ab250e8 @robrighter committed
Showing with 34 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +33 −2 tests/datastoretest.js
View
1 .gitignore
@@ -0,0 +1 @@
+cms-settings.js
View
35 tests/datastoretest.js
@@ -1,5 +1,36 @@
-var datastore = require('../datastore');
-
+var Datastore = require('../datastore').Datastore;
+var sys = require('sys');
+var ds = new Datastore();
//add content
+try{
+ ds.getRoot(function(root){
+ console.log('got a result: ' + sys.inspect(root));
+ if(!root){
+ console.log("No root item we need to make one...");
+ newroot = ds.makeContent('Folder');
+ newroot.title = "Test Root";
+ newroot.hidden_from_navigation = false;
+ newroot.article = 'This is the body copy of the article';
+ ds.addContentToSitemap(newroot, 0, 'homepagetemplate.ejs', function(result){
+ console.log('...Root Folder Added');
+ });
+ }
+ else{
+ //we got a root item
+ console.log(root.content.title);
+ console.log(root.content.article);
+ root.content.getChildren(function(result){
+ console.log(sys.inspect(result));
+ });
+
+ }
+ });
+}
+catch(e){
+ console.log('No Root Item');
+}
+
+
+//console.log(sys.inspect(ds.mixin({one: 1, two: 2}, {three: 3, four: 4}, {fn: function(){console.log('boosh');}})));
//query out the content by url

0 comments on commit 61f14ea

Please sign in to comment.
Something went wrong with that request. Please try again.