Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/proxy_server/node_modules/child_pids/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: var childPids = require('../index');
var chai = require('chai');
var proxyquire = require('proxyquire');
var expect = chai.expect;
var sampleData = require('./sample_data');
describe('childPids', function() {
it('returns an error if the process id cannot be found', function(done) {
var childPids = proxyquire('../index', {
'is-running': function() {
return false;
}
});
childPids.find(123, 0, function(err, pids) {
expect(err).to.be.ok;
done();
});
})
describe('isChild', function() {
var parentPidMap = sampleData.parentPidMap;
it('checks children on all levels for maxDepth <= 0', function() {
expect(childPids.isChild(1, 0, 0, parentPidMap)).to.be.true;
expect(childPids.isChild(43, 0, 0, parentPidMap)).to.be.true;
expect(childPids.isChild(56, 0, 0, parentPidMap)).to.be.true;
})
it('checks to a certain when maxDepth > 0', function() {
expect(childPids.isChild(1, 0, 1, parentPidMap)).to.be.true;
expect(childPids.isChild(43, 0, 1, parentPidMap)).to.be.false;
expect(childPids.isChild(56, 1, 2, parentPidMap)).to.be.true;
expect(childPids.isChild(56, 1, 1, parentPidMap)).to.be.false;
})
it('fails when there is no common parent', function() {
expect(childPids.isChild(43, 44, 0, parentPidMap)).to.be.false;
expect(childPids.isChild(56, 43, 0, parentPidMap)).to.be.false;
});
})
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]-- |