403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.163
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/node_modules/fs-monkey/lib/__tests__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/node_modules/fs-monkey/lib/__tests__/patchFs.test.js
"use strict";

var _patchFs = _interopRequireDefault(require("../patchFs"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

describe('patchFs', function () {
  it('should overwrite the .readFileSync method', function () {
    var vol = {
      readFileSync: function readFileSync() {
        return 'foo';
      }
    };
    var fs = {};
    (0, _patchFs["default"])(vol, fs);
    expect(_typeof(fs.readFileSync)).toBe('function');
    expect(fs.readFileSync()).toBe('foo');
  });
  it('should copy constants', function () {
    var vol = {
      F_OK: 123
    };
    var fs = {};
    (0, _patchFs["default"])(vol, fs);
    expect(fs.F_OK).toBe(vol.F_OK);
  });
  describe('unpatch()', function () {
    it('should return "unpatch" method', function () {
      var vol = {
        F_OK: 123
      };
      var fs = {};
      expect(_typeof((0, _patchFs["default"])(vol, fs))).toBe('function');
    });
    it('should restore the original fs', function () {
      var original = function original() {};

      var vol = {
        writeFileSync: function writeFileSync() {}
      };
      var fs = {
        writeFileSync: original
      };
      var unpatch = (0, _patchFs["default"])(vol, fs);
      expect(fs.writeFileSync).not.toBe(original);
      unpatch();
      expect(fs.writeFileSync).toBe(original);
    });
  });
});

Youez - 2016 - github.com/yon3zu
LinuXploit