Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/tradze/www/node-socket/node_modules/prompt/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/tradze/www/node-socket/node_modules/prompt/test/interactive-prompt-test.js
/*
 * prompt-test.js: Tests for prompt.
 *
 * (C) 2010, Nodejitsu Inc.
 *
 */

var assert = require('assert'),
    vows = require('vows'),
    prompt = require('../lib/prompt'),
    winston = require('winston').cli(),
    helpers = require('./helpers');

vows.describe('prompt/interactive').addBatch({
  "When using prompt": {
    topic: function () {
      //
      // Reset the prompt for interactive testing
      //
      prompt.started = false;
      prompt.start();
      winston.info('These prompt tests are interactive');
      winston.info('Not following instructions will result in test failure');
      return null;
    },
    "the getInput() method": {
      "when passed a complex property with `hidden: true`": {
        topic: function () {
          winston.info('When prompted, enter: 12345 [backspace] [backspace] [enter]');
          prompt.getInput({ path: ['password'], schema: helpers.schema.properties.password }, this.callback);
        },
        "should respond with `123`": function (err, result) {
          assert.isNull(err);
          assert.equal(result, '123');
        },
        "and then when passed a complex property expecting a number": {
          topic: function () {
            winston.info('When prompted, enter: 123 [enter]');
            prompt.getInput({ path: ['number'], schema: helpers.schema.properties.number }, this.callback);
          },
          "should respond with `123` (as a number)": function (err, result) {
            assert.isNull(err);
            assert.equal(result, 123);
          }
        }
      }
    }
  }
}).export(module);

ZeroDay Forums Mini