Posts

Showing posts from August, 2017

Firebase database.ServerValue.TIMESTAMP get current time

Firebase Server Time STAMP can only retive the value when it comminted to firebase database var currentTimeStamp=firebase.database.ServerValue.TIMESTAMP; value for this will be set when datbase operation like set ,push or update occures . In order to get the value you need to write code like below.   ref.child(test).child(time-stamp').set(firebaseAdmin.database.ServerValue.TIMESTAMP).then(function() {                           ref.child(test).once('value').then(function(Snapshot) {                                                          var currentTimeStamp= Snapshot.val()['time-stamp']; }); });

Firsby for Unit test Firebase REST API

Firebase required to iniciate in order to run test cases. Firsby is a api testing fromwork ,which can work with jasmine.  npm install jasmine-node -g Install frisby.js http://frisbyjs.com/ Create spec file witih spec folder Import depeldancy var request = require("request"); var server = require("./../src/test.js");   // server file var frisby = require('frisby'); Header value for every request frisby.globalSetup({ request: { headers: {'AccessToken':process.env.test_token}. // taken from the .env } }); Dependent Request frisby.create(' Login')   .post(process.env.npm_config_host+'/api/login',{.  //take the host when running test command         "profile-type": "test",         "mess-token":"" }) .after(function(err, res, body) {   frisby.create('Dome')     .post(process.env.npm_config_host+'/api/user',{           "profile-type": ...