text: const chai = require("chai");
  const chaiHttp = require("chai-http");
  const should = chai.should();
  const expect = chai.expect;
  const _ = require("underscore");
  const md5 = require("md5");
  const fs = require("fs");
  const path = require("path");
  const async = require("async");
  chai.use(chaiHttp);
  
  const rlequire = require("rlequire");
  const Config = rlequire("dendro", "src/models/meta/config.js").Config;
  
  const userUtils = rlequire("dendro", "test/utils/user/userUtils.js");
  const appUtils = rlequire("dendro", "test/utils/app/appUtils.js");
  const socialDendroUtils = rlequire("dendro", "test/utils/social/socialDendroUtils");
  
  const demouser1 = rlequire("dendro", "test/mockdata/users/demouser1.js");
  const demouser2 = rlequire("dendro", "test/mockdata/users/demouser2.js");
  const demouser3 = rlequire("dendro", "test/mockdata/users/demouser3.js");
  
  const createSocialDendroTimelineWithPostsAndSharesUnit = rlequire("dendro", "test/units/social/createSocialDendroTimelineWithPostsAndShares.Unit.js");
  const pageNumber = 1;
  let useRank = 0;
  let postURIsToCompare;
  
  function stripArrayToPostURISOnly (uris)
  {
      uris.forEach(function (element)
      {
          delete element.position;
          delete element.fixedPosition;
      });
      return uris;
  }
  
  describe("Get all posts URIs with pagination tests", function ()
  {
      this.timeout(Config.testsTimeout);
      before(function (done)
      {
          // creates the 3 type of posts for the 3 types of projects(public, private, metadataOnly)
          createSocialDendroTimelineWithPostsAndSharesUnit.setup(function (err, results)
          {
              should.equal(err, null);
              done();
          });
      });
  
      describe("[GET] Gets all posts URIs(with pagination) for each user [Valid cases] /posts/all", function ()
      {
          it("[For an unauthenticated user] Should give an unauthorized error", function (done)
          {
              const app = global.tests.app;
              const agent = chai.request.agent(app);
              socialDendroUtils.getPostsURIsForUser(true, agent, pageNumber, useRank, function (err, res)
              {
                  res.statusCode.should.equal(401);
                  res.body.message.should.equal("Error detected. You are not authorized to perform this operation. You must be signed into Dendro.");
                  done();
              });
          });
  
          it("[For demouser1, as the creator of all projects] Should give an array of five post URIs", function (done)
          {
              userUtils.loginUser(demouser1.username, demouser1.password, function (err, agent)
              {
                  socialDendroUtils.getPostsURIsForUser(true, agent, pageNumber, useRank, function (err, res)
                  {
                      res.statusCode.should.equal(200);
                      res.body.length.should.equal(30);
                      postURIsToCompare = stripArrayToPostURISOnly(res.body);
                      done();
                  });
              });
          });
  
          it("[For demouser2, a collaborator in all projects] Should give an array of five post URIs that equals to the array of five post URIs that demouser1 also received(because they work on the same projects)", function (done)
          {
              userUtils.loginUser(demouser2.username, demouser2.password, function (err, agent)
              {
                  socialDendroUtils.getPostsURIsForUser(true, agent, pageNumber, useRank, function (err, res)
                  {
                      res.statusCode.should.equal(200);
                      res.body.length.should.equal(30);
                      console.log(res.body);
                      expect(postURIsToCompare).to.eql(stripArrayToPostURISOnly(res.body));
                      done();
                  });
              });
          });
  
          it("[For demouser3, is not a creator or collaborator in any projects] the post URIs array should be empty and different from the post URIs array of demouser1 and demouser2", function (done)
          {
              userUtils.loginUser(demouser3.username, demouser3.password, function (err, agent)
              {
                  socialDendroUtils.getPostsURIsForUser(true, agent, pageNumber, useRank, function (err, res)
                  {
                      res.statusCode.should.equal(200);
                      res.body.length.should.equal(0);
                      expect(postURIsToCompare).to.not.eql(res.body);
                      done();
                  });
              });
          });
      });
  
      after(function (done)
      {
          // destroy graphs
  
          appUtils.clearAppState(function (err, data)
          {
              should.equal(err, null);
              done(err);
          });
      });
  });
  