remove messy/broken test
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent e1466b0 · Browse files · 1 file·+0 added−123 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+0 added−123 removed
- tests:+0 added−123 removed
Provenance
- Commit
7ab5bd1- Tree
6b56dfd- Author
TJ Holowaychuk <tj@vision-media.ca>- Committer
TJ Holowaychuk <tj@vision-media.ca>- Parent
e1466b0
1 file changed+0 added−123 removed
deleted:test/test.prompt.js-123 removed
1-/**2- * Module dependencies.3- */4-5-var events = require('events')6- , program = require('../')7- , should = require('should');8-9-// TODO: this is all super messy... rewrite10-11-//mock stdin on process12-var stdin = new events.EventEmitter();13-stdin.setEncoding = stdin.resume = function() {};14-stdin.write = function(data) { stdin.emit('data', data); };15-process.__defineGetter__('stdin', function() { return stdin });16-17-//mock stdout on process18-var stdout = new events.EventEmitter();19-stdout.write = function(data) { this.emit('data', data) };20-stdout.expect = function(expected, fn) {21- var actual = '';22- this.once('data', function(data){ actual = data; });23- fn();24- actual.should.equal(expected);25-}26-//var realOut = process.stdout;27-process.__defineGetter__('stdout', function() { return stdout });28-29-var count = 0;30-var test = function(expected) {31- count++;32- return function(actual) {33- count--;34- if(expected instanceof Date) {35- //need something better :(36- //using `new Date(date.toString())` round trip37- //loosing some precision for .getTime()38- actual.should.be.an.instanceof(Date);39- } else {40- actual.should.equal(expected);41- }42- }43-}44-45-process.on('exit', function(){46- count.should.equal(0);47-})48-49-/* Single Line String Prompt Tests */50-var prompt = 'hello '51- , expected = 'world';52-53-// simple single line string 54-stdout.expect(prompt, function(){55- program.prompt(prompt, test(expected));56- stdin.write(expected); 57-})58-// with trim59-stdout.expect(prompt, function(){60- program.prompt(prompt, test(expected));61- stdin.write(' ' + expected + ' '); 62-})63-// newline64-stdout.expect(prompt, function(){65- program.prompt(prompt, test(''));66- stdin.write('\n'); 67-})68-69-/* Multiline Tests*/70-var prompt = 'A multiline';71-stdout.expect(prompt + '\n', function() {72- program.prompt(prompt, test('hello world\n and what a world\nit could be'));73- stdin.write('hello world\n');74- stdin.write(' and what a world\n');75- stdin.write('it could be\n');76- stdin.write('\n');77-})78-79-/* Date Prompt Tests */80-var prompt = 'A date '81- , expected = new Date();82- 83-// simple date84-stdout.expect(prompt, function(){85- program.prompt(prompt, Date, test(expected));86- stdin.write(expected.toString()); 87-})88-// not a date twice89-stdout.expect(prompt, function() {90- program.prompt(prompt, Date, test(expected));91- 92- stdout.expect(prompt + '(must be a date) ', function() {93- stdin.write('blue'); 94- })95- stdout.expect(prompt + '(must be a date) ', function() {96- stdin.write('blue'); 97- })98- stdin.write(expected.toString()); 99-})100-101-/* Number Prompt Tests*/102-var prompt = 'A number '103- , expected = 12;104- 105-//simple number106-stdout.expect(prompt, function(){107- program.prompt(prompt, Number, test(expected));108- stdin.write(expected.toString()); 109-})110-111-// not a number twice112-stdout.expect(prompt, function() {113- program.prompt(prompt, Number, test(expected));114- 115- stdout.expect(prompt + '(must be a number) ', function() {116- stdin.write('blue'); 117- })118- stdout.expect(prompt + '(must be a number) ', function() {119- stdin.write('blue'); 120- })121- stdin.write(expected.toString()); 122-})123-