VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/local/lib/node_modules/forever/node_modules/broadway/node_modules/nconf/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/node_modules/forever/node_modules/broadway/node_modules/nconf/test/helpers.js
/*
 * helpers.js: Test helpers for nconf.
 *
 * (C) 2011, Nodejitsu Inc.
 *
 */
 
var assert = require('assert'),
    spawn = require('child_process').spawn,
    util = require('util'),
    fs = require('fs'),
    path = require('path'),
    nconf = require('../lib/nconf');

exports.assertMerged = function (err, merged) {
  merged = merged instanceof nconf.Provider 
    ? merged.store.store
    : merged;
    
  assert.isNull(err);
  assert.isObject(merged);
  assert.isTrue(merged.apples);
  assert.isTrue(merged.bananas);
  assert.isObject(merged.candy);
  assert.isTrue(merged.candy.something1);
  assert.isTrue(merged.candy.something2);
  assert.isTrue(merged.candy.something3);
  assert.isTrue(merged.candy.something4);
  assert.isTrue(merged.dates);
  assert.isTrue(merged.elderberries);
};

exports.assertSystemConf = function (options) {
  return {
    topic: function () {
      var env = null;
      
      if (options.env) {
        env = {}
        Object.keys(process.env).forEach(function (key) {
          env[key] = process.env[key];
        });
        
        Object.keys(options.env).forEach(function (key) {
          env[key] = options.env[key];
        });
      }
      
      var child = spawn('node', [options.script].concat(options.argv), { env: env });
      child.stdout.once('data', this.callback.bind(this, null));
    },
    "should respond with the value passed into the script": function (_, data) {
      assert.equal(data.toString(), 'foobar');
    }
  }
}

// copy a file
exports.cp = function (from, to, callback) {
  fs.readFile(from, function (err, data) {
    if (err) return callback(err);
    fs.writeFile(to, data, callback);
  });
};

exports.fixture = function (file) {
  return path.join(__dirname, 'fixtures', file);
};

VaKeR 2022