!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

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)

/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/avvio/test/   drwxr-xr-x
Free 13.06 GB of 57.97 GB (22.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     to-json.test.js (2.74 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict'

const test = require('tap').test
const boot = require('..')

test('to json', (t) => {
  t.plan(4)

  const app = boot()
  app
    .use(one)
    .use(two)
    .use(three)

  const outJson = {
    id: 'root',
    label: 'bound root',
    start: /\d+/,
    nodes: []
  }

  app.on('preReady', function show () {
    const json = app.toJSON()
    outJson.stop = /\d*/
    outJson.diff = /\d*/
    t.match(json, outJson)
  })

  function one (s, opts, done) {
    const json = app.toJSON()
    outJson.nodes.push({
      id: /.+/,
      parent: outJson.label,
      label: 'one',
      start: /\d+/
    })
    t.match(json, outJson)
    done()
  }
  function two (s, opts, done) {
    const json = app.toJSON()
    outJson.nodes.push({
      id: /.+/,
      parent: outJson.label,
      label: 'two',
      start: /\d+/
    })
    t.match(json, outJson)
    done()
  }
  function three (s, opts, done) {
    const json = app.toJSON()
    outJson.nodes.push({
      id: /.+/,
      parent: outJson.label,
      label: 'three',
      start: /\d+/
    })
    t.match(json, outJson)
    done()
  }
})

test('to json multi-level hierarchy', (t) => {
  t.plan(4)

  const server = { name: 'asd', count: 0 }
  const app = boot(server)

  const outJson = {
    id: 'root',
    label: 'bound root',
    start: /\d+/,
    nodes: [
      {
        id: /.+/,
        parent: 'bound root',
        start: /\d+/,
        label: 'first',
        nodes: [
          {
            id: /.+/,
            parent: 'first',
            start: /\d+/,
            label: 'second',
            nodes: [],
            stop: /\d+/,
            diff: /\d+/
          },
          {
            id: /.+/,
            parent: 'first',
            start: /\d+/,
            label: 'third',
            nodes: [
              {
                id: /.+/,
                parent: 'third',
                start: /\d+/,
                label: 'fourth',
                nodes: [],
                stop: /\d+/,
                diff: /\d+/
              }
            ],
            stop: /\d+/,
            diff: /\d+/
          }
        ],
        stop: /\d+/,
        diff: /\d+/
      }
    ],
    stop: /\d+/,
    diff: /\d+/
  }

  app.on('preReady', function show () {
    const json = app.toJSON()
    t.match(json, outJson)
  })

  app.override = function (s) {
    const res = Object.create(s)
    res.count = res.count + 1
    res.name = 'qwe'
    return res
  }

  app.use(function first (s1, opts, cb) {
    s1.use(second)
    s1.use(third)
    cb()

    function second (s2, opts, cb) {
      t.equal(s2.count, 2)
      cb()
    }

    function third (s3, opts, cb) {
      s3.use(fourth)
      t.equal(s3.count, 2)
      cb()
    }

    function fourth (s4, opts, cb) {
      t.equal(s4.count, 3)
      cb()
    }
  })
})

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0066 ]--