Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/readjs/node_modules/are-we-there-yet/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/readjs/node_modules/are-we-there-yet/test/trackerstream.js
'use strict'
var test = require('tap').test
var util = require('util')
var stream = require('readable-stream')
var TrackerStream = require('../index.js').TrackerStream
var testEvent = require('./lib/test-event.js')

var Sink = function () {
  stream.Writable.apply(this, arguments)
}
util.inherits(Sink, stream.Writable)
Sink.prototype._write = function (data, encoding, cb) {
  cb()
}

test('TrackerStream', function (t) {
  t.plan(9)

  var name = 'test'
  var track = new TrackerStream(name)

  t.is(track.completed(), 0, 'Nothing todo is 0 completion')

  var todo = 10
  track = new TrackerStream(name, todo)
  t.is(track.completed(), 0, 'Nothing done is 0 completion')

  track.pipe(new Sink())

  testEvent(track, 'change', afterCompleteWork)
  track.write('0123456789')
  function afterCompleteWork (er, onChangeName) {
    t.is(er, null, 'write: on change event fired')
    t.is(onChangeName, name, 'write: on change emits the correct name')
    t.is(track.completed(), 1, 'write: 100% completed')

    testEvent(track, 'change', afterAddWork)
    track.addWork(10)
  }
  function afterAddWork (er, onChangeName) {
    t.is(er, null, 'addWork: on change event fired')
    t.is(track.completed(), 0.5, 'addWork: 50% completed')

    testEvent(track, 'change', afterAllWork)
    track.write('ABCDEFGHIJKLMNOPQRST')
  }
  function afterAllWork (er) {
    t.is(er, null, 'allWork: on change event fired')
    t.is(track.completed(), 1, 'allWork: 100% completed')
  }
})

Youez - 2016 - github.com/yon3zu
LinuXploit